#include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int l, r;
};
bool cmp(const Node &a, const Node &b)
{
return a.r < b.r;
}
map<Node, int, function<bool(const Node &, const Node &)>> mp(cmp);
int n, q;
void solve(void)
{
cin >> n >> q;
for (int i = 1; i <= q; i++)
{
int op;
cin >> op;
if (op == 1)
{
int l, r, k;
cin >> l >> r >> k;
mp.insert({{l, r}, k});
}
else
{
int l, r;
cin >> l >> r;
cout << mp[{l, r}] << '\n';
}
}
return;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
solve();
return 0;
}