#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector< vector<int> > nums(n + 1);
while(m--)
{
int t, i, j, k;
cin >> t;
if(t == 1)
{
cin >> i >> j >> k;
if(nums[i].size() < j +1)
nums[i].resize(j + 1);
nums[i][j] = k;
}
else
{
cin >> i >> j;
cout << nums[i][j] << endl;
}
}
return 0;
}