#include<stdio.h>
int n,q[100005];
int i,j,k,goods[100005];
int m=0,h=0;
struct locker{
int grid[100005];
}L[100005];//定义寄存柜
int main()
{
scanf("%d %d",&n,&q[0]);//q[0]为操作次数
for(int x=1;x<=q[0];x++)
{
scanf("%d",&q[x]);
if(q[x]==1){
scanf("%d %d %d",&i,&j,&k);
L[i].grid[j]=k;
}
else {
scanf("%d %d",&i,&j);
goods[m]=L[i].grid[j];
m++;
}
}
while(h<m){
printf("%d\n",goods[h]);
h++;
}
}