import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;
public class Main {
static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
static Scanner scanner = new Scanner(new BufferedInputStream(System.in));
static int n,m,op;
static HashMap<Integer,Node> map = new HashMap<>();
public static void main(String[] args) throws IOException {
n=scanner.nextInt();
m=scanner.nextInt();
while(m--!=0) {
op=scanner.nextInt();
if(op==1) {
int a=scanner.nextInt(),
b=scanner.nextInt(),
c=scanner.nextInt();
map.put(a, new Node(b, c));
}else if(op==2) {
int d=scanner.nextInt(),
e=scanner.nextInt();
out.println(map.get(d).getMap().get(e));
}
}
out.flush();
}
static class Node{
HashMap<Integer, Integer> map = new HashMap<>();
public Node(int a,int b) {
map.put(a, b);
}
public HashMap<Integer, Integer> getMap() {
return map;
}
}
}