#include<bits/stdc++.h>
using namespace std;
struct beibao
{
int i;
int j;
beibao() {
i = 0; j = 0;
}
explicit beibao(int x, int y) : i(x), j(y) {}
bool operator<(const beibao& other) const {
if (other.i < i) {
return true;
}
return false;
}
};
int main()
{
int n = 0, t = 0;
cin >> n >> t;
map<beibao, int>arr;
while (t--)
{
int a = 0, b = 0, c = 0, d = 0;
scanf("%d%d%d", &a, &b, &c);
beibao temp;
temp.i = b;
temp.j = c;
if (a == 1)
{
scanf("%d", &d);
auto it = arr.find(temp);
if (it == arr.end())
{
arr[temp] = d;
}
else
{
it->second = d;
}
}
if (a == 2)
{
auto it =arr.find(temp);
printf("%d\n", it->second);
}
}
}