#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#define maxn 100000000
using namespace std;
struct bao {
int x, y,zhi;
}b[maxn];
int point = 0;
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int pan;
cin >> pan;
if (pan == 1) {
int x, y, zhi;
cin >> x >> y >> zhi;
b[point].x = x, b[point].y = y, b[point].zhi = zhi;
point++;
}
else if (pan == 2) {
int x, y;
cin >> x >> y;
for (int j = 0; j < point; ++j) {
if (b[j].x == x && b[j].y == y) {
cout << b[j].zhi << endl;
break;
}
}
}
}
}