#include <bits/stdc++.h>
using namespace std;
map<long long,int> mp;
int main()
{
int n,q;
cin >> n >> q;
long long op,a,b,c;
for(int i = 1;i <= q;i++)
{
cin >> op >> a >> b;
if(op == 1)
{
cin >> c;
mp[a * int(1e5) + b] = c;
}
else
{
cout << mp[a * int(1e5) + b] << endl;
}
}
return 0;
}