#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n, q, cmd, i, j, k;
int main() {
cin >> n >> q;
vector<vector<int> > locker(n + 1);//动态声明大小
while (q--) {
cin >> cmd;
if (cmd == 1) {
cin >> i >> j >> k;
if (locker[i].size() < j + 1) locker[i].resize(j + 1);
locker[i][j] = k;
} else {
cin >> i >> j;
cout << locker[i][j] << endl;
}
}
return 0;
}