#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
long long n,d,q;
long long a,b,c;
struct S {
long long a,b;
bool operator<(const S& t)const {
return b>t.b;
}
}aa;
map<S,long long>m;
int main() {
scanf("%lld%lld",&n,&q);
for(long long i=0; i<q; i++) {
scanf("%lld",&d);
if(d==2) {
scanf("%lld %lld",&a,&b);
aa={a,b};
printf("%lld\n",m[aa]);
} else {
scanf("%lld %lld %lld",&a,&b,&c);
aa={a,b};
m[aa]=c;
}
}
return 0;
}