#include<bits/stdc++.h>
using namespace std;
int n,q,f,x,y,z;
vector<vector<int> > a(n+1);
int main(){
cin>>n>>q;
while(q--){
cin>>f;
if(f==1){
cin>>x>>y>>z;
if(a[x].size()<y+1) a[x].resize(y+1);
a[x][y]=z;
}else{
cin>>x>>y;
cout<<a[x][y]<<endl;
}
}
return 0;
}