#include <bits/stdc++.h>
#define hell                         1000000007

#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                            int

#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;

vector<pair<ll,ll>>graph[5005];
vector<pair<ll,ll>>parent[5005];
ll visited[5005];
void dfs(ll u,ll v,ll mm,ll index)
{
	parent[mm][u]={v,index};

	visited[u]=1;

	for(auto i:graph[u])
	{
		if(i.F!=v)
		{
			dfs(i.F,u,mm,i.S);
		}
	}
}

  int main()

{

ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);

	ll i,j;
	ll n;
	cin>>n;

	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			parent[i].pb({j,0});
		}
	}

	vector<pair<ll,pair<ll,ll>>>queries;
	for(i=0;i<n-1;i++)
	{
		ll u,v;
		cin>>u>>v;
		u--;
		v--;

		graph[u].pb({v,i});
		graph[v].pb({u,i});
	}

	ll q;
	cin>>q;

	for(i=0;i<n;i++)
	{
		dfs(i,i,i,-1);

	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		cin>>u>>v>>w;
		u--;
		v--;
		queries.pb({w,{u,v}});
	}
	sort(all(queries));

	ll val[n];
	for(i=0;i<n;i++)
	{
		val[i]=0;
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		while(parent[u][v].F!=v)
		{
				val[parent[u][v].S]=max(w,val[parent[u][v].S]);
				v=parent[u][v].F;
		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		ll maxi=1000000;

		while(parent[u][v].F!=v)
		{
			maxi=min(val[parent[u][v].S],maxi);
			v=parent[u][v].F;
		}

		if(maxi!=w)
		{
			cout<<"-1"<<endl;
			return 0;
		}

	}

	for(i=0;i<n-1;i++)
	{

		if(val[i]==0)
		{
			cout<<1000<<" ";
		}
		else
		{
			cout<<val[i]<<" ";
		}
	}
	cout<<endl;

}


#include <bits/stdc++.h>

using namespace std;

int n, m;
vector<int> val;
vector<vector<pair<int, int>>> g;

void dfs(int v, int pv, int pe, vector<pair<int, int>> &p) {
	p[v] = make_pair(pv, pe);
	for (auto it : g[v]) {
		int to = it.first;
		int idx = it.second;
		if (to == pv) continue;
		dfs(to, v, idx, p);
	}
}

int main() {

	cin >> n;
	g = vector<vector<pair<int, int>>>(n);
	for (int i = 0; i < n - 1; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		g[u].push_back(make_pair(v, i));
		g[v].push_back(make_pair(u, i));
	}

	vector<vector<pair<int, int>>> p(n, vector<pair<int, int>>(n));
	for (int i = 0; i < n; ++i) {
		dfs(i, -1, -1, p[i]);
	}

	val = vector<int>(n - 1, 1000000);

    cin >> m;
	vector<pair<pair<int, int>, int>> q(m);
	for (int i = 0; i < m; ++i) {
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		--q[i].first.first;
		--q[i].first.second;
	}
	sort(q.begin(), q.end(), [&](pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
		return a.second < b.second;
	});

	for (int i = 0; i < m; ++i) {
		int u = q[i].first.first;
		int v = q[i].first.second;
		while (v != u) {
			int pv = p[u][v].first;
			int pe = p[u][v].second;
			val[pe] = q[i].second;
			v = pv;
		}
	}

	for (int i = 0; i < m; ++i) {
		int u = q[i].first.first;
		int v = q[i].first.second;
		int mx = 1000000;
		while (v != u) {
			int pv = p[u][v].first;
			int pe = p[u][v].second;
			mx = min(mx, val[pe]);
			v = pv;
		}
		if (mx != q[i].second) {
			cout << -1 << endl;
			return 0;
		}
	}

	for (int i = 0; i < n - 1; ++i) {
		cout << val[i] << " ";
	}
	cout << endl;

	return 0;
}


#include <bits/stdc++.h>
#define hell                         1000000007

#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                            int

#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;

vector<ll>graph[200005];
vector<ll>parent[200005];
ll visited[100005];
void dfs(ll u,ll v,ll mm)
{
	parent[mm][u]=v;

	visited[u]=1;

	for(auto i:graph[u])
	{
		if(!visited[i])
		{
			dfs(i,u,mm);
		}
	}
}

  int main()

{

ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);

	ll i,j;
	ll n;
	cin>>n;

	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			parent[i].pb(j);
		}
	}

	vector<pair<ll,pair<ll,ll>>>edges,queries;
	for(i=0;i<n-1;i++)
	{
		ll u,v;
		cin>>u>>v;
		u--;
		v--;
		edges.pb({i,{u,v}});
		graph[u].pb(v);
		graph[v].pb(u);
	}

	ll q;
	cin>>q;

	for(i=0;i<n;i++)
	{
		dfs(i,i,i);

		for(j=0;j<n;j++)
		{
			visited[j]=0;
		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		cin>>u>>v>>w;
		u--;
		v--;
		queries.pb({w,{u,v}});
	}
	sort(all(queries));

	map<pair<ll,ll>,ll>m1;

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		while(parent[u][v]!=v)
		{
			if(m1.find({v,parent[u][v]})==m1.end())
			{
				m1[{v,parent[u][v]}]=w;
				m1[{parent[u][v],v}]=w;
				v=parent[u][v];
				continue;
			}
			m1[{parent[u][v],v}]=max(m1[{parent[u][v],v}],w);
			m1[{v,parent[u][v]}]=max(m1[{parent[u][v],v}],w);

		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		ll maxi=1000000;

		while(parent[u][v]!=v)
		{
			maxi=min(m1[{parent[u][v],v}],maxi);
			v=parent[u][v];
		}

		if(maxi!=w)
		{
			cout<<"-1"<<endl;
			return 0;
		}

	}

	for(i=0;i<n-1;i++)
	{
		ll u,v;
		u=edges[i].S.F;
		v=edges[i].S.S;

		if(m1.find({u,v})==m1.end())
		{
			cout<<1000<<" ";
		}
		else
		{
			cout<<m1[{u,v}]<<" ";
		}
	}
	cout<<endl;

}


#include <bits/stdc++.h>
#define hell                         1000000007

#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                            int

#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;

vector<ll>graph[200005];
vector<ll>parent[200005];
ll visited[100005];
void dfs(ll u,ll v,ll mm)
{
	parent[mm][u]=v;

	visited[u]=1;

	for(auto i:graph[u])
	{
		if(!visited[i])
		{
			dfs(i,u,mm);
		}
	}
}

  int main()

{

ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);

	ll i,j;
	ll n;
	cin>>n;

	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			parent[i].pb(j);
		}
	}

	vector<pair<ll,pair<ll,ll>>>edges,queries;
	for(i=0;i<n-1;i++)
	{
		ll u,v;
		cin>>u>>v;
		u--;
		v--;
		edges.pb({i,{u,v}});
		graph[u].pb(v);
		graph[v].pb(u);
	}

	ll q;
	cin>>q;

	for(i=0;i<n;i++)
	{
		dfs(i,i,i);

		for(j=0;j<n;j++)
		{
			visited[j]=0;
		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		cin>>u>>v>>w;
		u--;
		v--;
		queries.pb({w,{u,v}});
	}
	sort(all(queries));

	map<pair<ll,ll>,ll>m1;

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		if(u==v)
		{
			cout<<-1<<endl;
			return 0;
		}

		while(parent[u][v]!=v)
		{
			if(m1.find({v,parent[u][v]})==m1.end())
			{
				m1[{v,parent[u][v]}]=w;
				m1[{parent[u][v],v}]=w;
				v=parent[u][v];
				continue;
			}
			m1[{parent[u][v],v}]=max(m1[{parent[u][v],v}],w);
			m1[{v,parent[u][v]}]=max(m1[{parent[u][v],v}],w);
			v=parent[u][v];

		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		ll maxi=1000000;

		while(parent[u][v]!=v)
		{
			maxi=min(m1[{parent[u][v],v}],maxi);
			v=parent[u][v];
		}

		if(maxi!=w)
		{
			cout<<"-1"<<endl;
			return 0;
		}

	}

	for(i=0;i<n-1;i++)
	{
		ll u,v;
		u=edges[i].S.F;
		v=edges[i].S.S;

		if(m1.find({u,v})==m1.end())
		{
			cout<<1000<<" ";
		}
		else
		{
			cout<<m1[{u,v}]<<" ";
		}
	}
	cout<<endl;

}


#include <bits/stdc++.h>
#define hell                         1000000007

#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                            int

#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;

vector<pair<ll,ll>>graph[200005];
vector<pair<ll,ll>>parent[200005];
ll visited[100005];
void dfs(ll u,ll v,ll mm,ll index)
{
	parent[mm][u]={v,index};

	visited[u]=1;

	for(auto i:graph[u])
	{
		if(!visited[i.F])
		{
			dfs(i.F,u,mm,i.S);
		}
	}
}

  int main()

{

ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);

	ll i,j;
	ll n;
	cin>>n;

	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			parent[i].pb({j,0});
		}
	}

	vector<pair<ll,pair<ll,ll>>>queries;
	for(i=0;i<n-1;i++)
	{
		ll u,v;
		cin>>u>>v;
		u--;
		v--;

		graph[u].pb({v,i});
		graph[v].pb({u,i});
	}

	ll q;
	cin>>q;

	for(i=0;i<n;i++)
	{
		dfs(i,i,i,-1);

		for(j=0;j<n;j++)
		{
			visited[j]=0;
		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		cin>>u>>v>>w;
		u--;
		v--;
		queries.pb({w,{u,v}});
	}
	sort(all(queries));

	map<pair<ll,ll>,ll>m1;

	ll val[n];
	for(i=0;i<n;i++)
	{
		val[i]=0;
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		if(u==v)
		{
			cout<<-1<<endl;
			return 0;
		}

		while(parent[u][v].F!=v)
		{
				val[parent[u][v].S]=w;
				v=parent[u][v].F;
		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		ll maxi=1000000;

		while(parent[u][v].F!=v)
		{
			maxi=min(val[parent[u][v].S],maxi);
			v=parent[u][v].F;
		}

		if(maxi!=w)
		{
			cout<<"-1"<<endl;
			return 0;
		}

	}

	for(i=0;i<n-1;i++)
	{

		if(val[i]==0)
		{
			cout<<1000<<" ";
		}
		else
		{
			cout<<val[i]<<" ";
		}
	}
	cout<<endl;

}


#include <bits/stdc++.h>
#define hell                         1000000007

#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                            int

#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;

vector<pair<ll,ll>>graph[5005];
vector<pair<ll,ll>>parent[5005];
ll visited[5005];
void dfs(ll u,ll v,ll mm,ll index)
{
	parent[mm][u]={v,index};

	visited[u]=1;

	for(auto i:graph[u])
	{
		if(i.F!=v)
		{
			dfs(i.F,u,mm,i.S);
		}
	}
}

  int main()

{

ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);

	ll i,j;
	ll n;
	cin>>n;

	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			parent[i].pb({j,0});
		}
	}

	vector<pair<ll,pair<ll,ll>>>queries;
	for(i=0;i<n-1;i++)
	{
		ll u,v;
		cin>>u>>v;
		u--;
		v--;

		graph[u].pb({v,i});
		graph[v].pb({u,i});
	}

	ll q;
	cin>>q;

	for(i=0;i<n;i++)
	{
		dfs(i,i,i,-1);

	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		cin>>u>>v>>w;
		u--;
		v--;
		queries.pb({w,{u,v}});
	}
	sort(all(queries));

	ll val[n];
	for(i=0;i<n;i++)
	{
		val[i]=0;
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		while(parent[u][v].F!=v)
		{
				val[parent[u][v].S]=w;
				v=parent[u][v].F;
		}
	}

	for(i=0;i<q;i++)
	{
		ll u,v,w;
		w=queries[i].F;
		u=queries[i].S.F;
		v=queries[i].S.S;

		ll maxi=1000000;

		while(parent[u][v].F!=v)
		{
			maxi=min(val[parent[u][v].S],maxi);
			v=parent[u][v].F;
		}

		if(maxi!=w)
		{
			cout<<"-1"<<endl;
			return 0;
		}

	}

	for(i=0;i<n-1;i++)
	{

		if(val[i]==0)
		{
			cout<<1000<<" ";
		}
		else
		{
			cout<<val[i]<<" ";
		}
	}
	cout<<endl;

}


//#include "/Users/manishkumar/Work/stdc++.h"
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,n) for(long long i=a;i<=n;i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n-1)
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define ll long long int
#define vi vector<int>
# define INF32 0x3f3f3f3f
# define INF64 1e18

vector<vi> adj;
int n;

vector<int> bfs(int src, int dst) {

    vector<int> res;
    vector<int>  parent(n,-1);
    vector<int> isVis(n,false);

    queue<int> qu;
    qu.push(src);
    isVis[src] = true ;

    bool isFound = false;

    while(!qu.empty()) {
        int u = qu.front();
        qu.pop();

        for(int v:adj[u]) {

            if(!isVis[v]) {
                isVis[v] = true;
                parent[v] = u;

                if(v == dst) {
                    isFound = true;
                    break;
                }

                qu.push(v);
            }

        }

        if(isFound) break;
    }

    int tmp = dst;
    res.push_back(dst);
    while(parent[tmp]!=-1) {
        res.push_back(parent[tmp]);
        tmp = parent[tmp];
    }

    return res;
}

int main() {
    sync
//    int T;
//    cin>>T ;
//
//    while(T--) {

    cin>>n;
    adj = vector<vi>(n);

    vector<pair<int,int>> pr;
    int x,y;

    unordered_map<string, int> beauty_weight;

    for(int i=0;i<n-1;++i) {
        cin>>x>>y;
        --x;--y;
        adj[x].pb(y);
        adj[y].pb(x);

        if(x>y) swap(x, y);
        pr.pb(make_pair(x, y));
        string key = to_string(x)+":"+to_string(y);
        beauty_weight[key] = 0;
    }

    int m;
    cin>>m;

    unordered_map<string, vector<int>> query_path;

    vector<pair<pair<int, int>, int>> q(m);
    for (int i = 0; i < m; ++i) {
        cin >> q[i].first.first >> q[i].first.second >> q[i].second;
        --q[i].first.first;
        --q[i].first.second;

        if(q[i].first.first > q[i].first.second) swap(q[i].first.first, q[i].first.second);
    }

    sort(q.begin(), q.end(), [&](pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
        return a.second < b.second;
    });

    for(int i=0;i<m;++i) {

        int u = q[i].first.first;
        int v = q[i].first.second;
        int wt = q[i].second;

        string key = to_string(u)+":"+to_string(v);
        vector<int> path ;

        if(query_path.find(key)==query_path.end()) {
            path = bfs(u, v);
            query_path[key] = path;
        } else {
            path = query_path[key];
        }

        int __ns = path.size();

        for(int j=1;j<__ns;++j) {
            int __u = path[j];
            int __v = path[j-1];

            if(__u > __v ) swap(__u, __v);
            string __key  = to_string(__u)+":"+to_string(__v);
            beauty_weight[__key] = max(wt, beauty_weight[__key]);
        }
    }

    for(pair<int,int> tmp:pr) {
        string __key = to_string(tmp.first)+":"+to_string(tmp.second);
        if(beauty_weight[__key] == 0) beauty_weight[__key] = 1000000;
    }

    bool isPoss = true;

    for(int i=0;i<m;++i) {

        int u = q[i].first.first;
        int v = q[i].first.second;
        int wt = q[i].second;

        string key = to_string(u)+":"+to_string(v);
        vector<int> path ;

        path = query_path[key];

        int __ns = path.size();

        bool match = false;
        for(int j=1;j<__ns;++j) {
            int __u = path[j];
            int __v = path[j-1];

            if(__u > __v ) swap(__u, __v);
            string __key  = to_string(__u)+":"+to_string(__v);

            if(beauty_weight[__key] == wt) match = true;

        }

        if(!match) {
            isPoss = false;
            break;
        }

    }

    if(!isPoss) {
        cout<<-1<<"\n";
    } else {
        for(pair<int,int> tmp:pr) {
               string __key = to_string(tmp.first)+":"+to_string(tmp.second);
                cout<<beauty_weight[__key]<<" ";
           }
        cout<<"\n";
    }

    return 0;
}


//#include "/Users/manishkumar/Work/stdc++.h"
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,n) for(long long i=a;i<=n;i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n-1)
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define ll long long int
#define vi vector<int>
# define INF32 0x3f3f3f3f
# define INF64 1e18

vector<vi> adj;
int n;

vector<int> bfs(int src, int dst) {

    vector<int> res;
    vector<int>  parent(n,-1);
    vector<int> isVis(n,false);

    queue<int> qu;
    qu.push(src);
    isVis[src] = true ;

    bool isFound = false;

    while(!qu.empty()) {
        int u = qu.front();
        qu.pop();

        for(int v:adj[u]) {

            if(!isVis[v]) {
                isVis[v] = true;
                parent[v] = u;

                if(v == dst) {
                    isFound = true;
                    break;
                }

                qu.push(v);
            }

        }

        if(isFound) break;
    }

    int tmp = dst;
    res.push_back(dst);
    while(parent[tmp]!=-1) {
        res.push_back(parent[tmp]);
        tmp = parent[tmp];
    }

    return res;
}

int main() {
    sync
//    int T;
//    cin>>T ;
//
//    while(T--) {

    cin>>n;
    adj = vector<vi>(n);

    vector<pair<int,int>> pr;
    int x,y,z;
    for(int i=0;i<n-1;++i) {
        cin>>x>>y;
        --x;--y;

        pr.pb(make_pair(x, y));
        adj[x].pb(y);
        adj[y].pb(x);
    }

    int m;
    cin>>m;

    unordered_map<string, int> weightmp;

    bool isPoss = true;
    for(int i=0;i<m;++i) {
        cin>>x>>y>>z;
        --x;--y;

        vector<int> path_q = bfs(x, y);

        int __ns = (int)path_q.size();
        bool isUpdated = false;

        for(int j=1;j<__ns;++j) {
            int u = path_q[j];
            int v = path_q[j-1];

            if(u>v) swap(u,v);
            string key = to_string(u)+":"+to_string(v);

            if(weightmp.find(key) == weightmp.end()) {
                weightmp[key] = z;
                isUpdated = true;
            } else if( (weightmp.find(key) != weightmp.end()) && weightmp[key]<z ) {
                isPoss = false;
                break;
            } else if( (weightmp.find(key) != weightmp.end()) && (weightmp[key]==z) ) {
                isUpdated = true;
            }
        }

        if(!isPoss) break;
        if(!isUpdated) {
            isPoss = false;
            break;
        }
    }

    if(!isPoss) {
        cout<<-1<<"\n";
    } else {
        for(pair<int,int> tmp_pr:pr) {
            if(tmp_pr.first > tmp_pr.second) swap(tmp_pr.first, tmp_pr.second);

            string key = to_string(tmp_pr.first)+":"+to_string(tmp_pr.second);
            if(weightmp.find(key)!=weightmp.end()) {
                cout<<weightmp[key]<<" ";
            } else {
                cout<<1000000<<" ";
            }
        }
    }

    return 0;
}


//#include "/Users/manishkumar/Work/stdc++.h"
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,n) for(long long i=a;i<=n;i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n-1)
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define ll long long int
#define vi vector<int>
# define INF32 0x3f3f3f3f
# define INF64 1e18

vector<vi> adj;
int n;

vector<int> bfs(int src, int dst) {

    vector<int> res;
    vector<int>  parent(n,-1);
    vector<int> isVis(n,false);

    queue<int> qu;
    qu.push(src);
    isVis[src] = true ;

    bool isFound = false;

    while(!qu.empty()) {
        int u = qu.front();
        qu.pop();

        for(int v:adj[u]) {

            if(!isVis[v]) {
                isVis[v] = true;
                parent[v] = u;

                if(v == dst) {
                    isFound = true;
                    break;
                }

                qu.push(v);
            }

        }

        if(isFound) break;
    }

    int tmp = dst;
    res.push_back(dst);
    while(parent[tmp]!=-1) {
        res.push_back(parent[tmp]);
        tmp = parent[tmp];
    }

    return res;
}

int main() {
    sync
//    int T;
//    cin>>T ;
//
//    while(T--) {

    cin>>n;
    adj = vector<vi>(n);

    vector<pair<int,int>> pr;
    int x,y;

    unordered_map<string, int> beauty_weight;

    for(int i=0;i<n-1;++i) {
        cin>>x>>y;
        --x;--y;
        adj[x].pb(y);
        adj[y].pb(x);

        if(x>y) swap(x, y);
        pr.pb(make_pair(x, y));
        string key = to_string(x)+":"+to_string(y);
        beauty_weight[key] = 0;
    }

    int m;
    cin>>m;

    unordered_map<string, vector<int>> query_path;

    vector<pair<pair<int, int>, int>> q(m);
    for (int i = 0; i < m; ++i) {
        cin >> q[i].first.first >> q[i].first.second >> q[i].second;
        --q[i].first.first;
        --q[i].first.second;

        if(q[i].first.first > q[i].first.second) swap(q[i].first.first, q[i].first.second);
    }

    sort(q.begin(), q.end(), [&](pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
        return a.second < b.second;
    });

    for(int i=0;i<m;++i) {

        int u = q[i].first.first;
        int v = q[i].first.second;
        int wt = q[i].second;

        string key = to_string(u)+":"+to_string(v);
        vector<int> path ;

        if(query_path.find(key)==query_path.end()) {
            path = bfs(u, v);
            query_path[key] = path;
        } else {
            path = query_path[key];
        }

        int __ns = path.size();

        for(int j=1;j<__ns;++j) {
            int __u = path[j];
            int __v = path[j-1];

            if(__u > __v ) swap(__u, __v);
            string __key  = to_string(__u)+":"+to_string(__v);
            beauty_weight[__key] = max(wt, beauty_weight[__key]);
        }
    }

    for(int i=0;i<m;++i) {

        int u = q[i].first.first;
        int v = q[i].first.second;
        int wt = q[i].second;

        string key = to_string(u)+":"+to_string(v);
        vector<int> path ;

        path = query_path[key];

        int __ns = path.size();

        bool match = false;
        for(int j=1;j<__ns;++j) {
            int __u = path[j];
            int __v = path[j-1];

            if(__u > __v ) swap(__u, __v);
            string __key  = to_string(__u)+":"+to_string(__v);

            if(beauty_weight[__key] == 0) beauty_weight[__key] = 1000000;
            if(beauty_weight[__key] == wt) match = true;

        }

        if(!match) {
            cout<<-1<<"\n";
            return 0;
        }

    }

        for(pair<int,int> tmp:pr) {
                string __key = to_string(tmp.first)+":"+to_string(tmp.second);
                if(beauty_weight[__key] == 0) beauty_weight[__key] = 1000000;
                cout<<beauty_weight[__key]<<" ";
           }

        cout<<"\n";

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int x1, x2, y1, y2;
int res, n, cnt = 0, ax, ay, by, bx, mid;
bool Find, row, colum;
bool l;
int main(){
	FAST
	cin >> n;
	x1 = y1 = 1, x2 = n, y2 = 1;
	Find = row = colum = 0;
	ay = ax = by = bx = 0;
	l = 0;
	while(1){
		if(cnt < n + n){
			cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
		}else{
			if(row && colum){
				cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
			}else{
				if(row){
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << mid << endl;
					}else{
						cout << "? " << x1 << ' ' << mid << ' ' << x2 << ' ' << y2 << endl;
					}
				}else{
					//same row
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << mid << ' ' << y2 << endl;
					}else{
						cout << "? " << mid << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
					}
				}
			}
		}
		fflush(stdout);
		cin >> res;
		cnt++;
		if(cnt < n){
			if(res & 1){
				if(!ay) ay = y1;
				else by = y1;
				colum = 1;
			}
			++y1, ++y2;
		}else if(cnt <= n + n){
			if(cnt == n){
				if(res & 1){
					if(!ay) ay = y1;
					else by = y1;
					colum = 1;
				}
				y1 = 1, y2 = n, x2 = 1;
			}else if(cnt == n + n){
				if(res & 1){
					if(!ax) ax = x1;
					else bx = x1;
					row = 1;
				}
				if(row && colum){
					x1 = y1 = 1, x2 = ax, y2 = ay;
				}else{
					if(row){
						x1 = x2 = ax;
						y1 = 1, y2 = n;
						mid = (y1 + y2) / 2;
					}else{
						//same row
						y1 = y2 = ay;
						x1 = 1, x2 = n;
						mid = (x1 + x2) / 2;
					}
				}
			}else{
				if(res & 1){
					if(!ax) ax = x1;
					else bx = x1;
					row = 1;
				}
				++x1, ++x2;
			}
		}else{
			if(row && colum){
				Find = 1;
				if(res & 1){}
				else{
					swap(ay, by);
				}
			}else{
				l = 0;
				if(row){
					if(res & 1){
						l = 1;
						if(y1 == y2){
							Find = 1;
							ay = by = y1;
						}else{
							y2 = mid;
							mid = (y1 + y2) / 2;
						}
					}else{
						y1 = mid + 1;
						mid = (y1 + y2) / 2;
					}
				}else{
					l = 0;
					if(res & 1){
						l = 1;
						if(x1 == x2){
							Find = 1;
							ax = bx = x1;
						}else{
							x2 = mid;
							mid = (x1 + x2) / 2;
						}
					}else{
						x1 = mid + 1;
						mid = (x1 + x2) / 2;
					}
				}
			}
		}
		if(Find){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
			break;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define LL long long

LL x1, x2, y1, y2;
LL res, n, cnt = 0, ax, ay, by, bx, mid;
bool Find, row, colum;
bool l;
int main(){
	FAST
	cin >> n;
	x1 = y1 = 1, x2 = n, y2 = 1;
	Find = row = colum = 0;
	ay = ax = by = bx = 0;
	l = 1;
	while(1){
		if(cnt < n + n){
			cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
		}else{
			if(row && colum){
				cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
			}else{
				if(row){
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << mid << endl;
					}else{
						cout << "? " << x1 << ' ' << mid << ' ' << x2 << ' ' << y2 << endl;
					}
				}else{
					//same row
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << mid << ' ' << y2 << endl;
					}else{
						cout << "? " << mid << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
					}
				}
			}
		}
		fflush(stdout);
		cin >> res;
		cnt++;
		if(cnt < n){
			if(res & 1){
				if(!ay) ay = y1;
				else{
					by = y1;
					cnt = n + 1;
				}
				colum = 1;
			}
			++y1, ++y2;
		}else if(cnt <= n + n){
			if(cnt == n){
				if(res & 1){
					if(!ay) ay = y1;
					else by = y1;
					colum = 1;
				}
				y1 = 1, y2 = n, x2 = 1;
			}else if(cnt == n + n){
				if(res & 1){
					if(!ax) ax = x1;
					else bx = x1;
					row = 1;
				}
				if(row && colum){
					x1 = y1 = 1, x2 = ax, y2 = ay;
				}else{
					if(row){
						x1 = x2 = ax;
						y1 = 1, y2 = n;
						mid = (y1 + y2) / 2;
					}else{
						//same row
						y1 = y2 = ay;
						x1 = 1, x2 = n;
						mid = (x1 + x2) / 2;
					}
				}
			}else{
				if(res & 1){
					if(!ax) ax = x1;
					else{
						bx = x1;
						cnt = n + n;
					}
					row = 1;
				}
				++x1, ++x2;
			}
		}else{
			if(row && colum){
				Find = 1;
				if(res & 1){}
				else{
					swap(ay, by);
				}
			}else{
				l = 0;
				if(row){
					if(res & 1){
						l = 1;
						if(y1 == y2){
							Find = 1;
							ay = by = y1;
						}else{
							y2 = mid;
							mid = (y1 + y2) / 2;
						}
					}else{
						y1 = mid + 1;
						if(y1 > y2) y2 = y1;
						mid = (y1 + y2) / 2;
					}
				}else{
					l = 0;
					if(res & 1){
						l = 1;
						if(x1 == x2){
							Find = 1;
							ax = bx = x1;
						}else{
							x2 = mid;
							mid = (x1 + x2) / 2;
						}
					}else{
						x1 = mid + 1;
						if(x1 > x2) x2 = x1;
						mid = (x1 + x2) / 2;
					}
				}
			}
		}
		if(Find){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
			break;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define ist insert
#define endl "\n"
#define pb push_back
#define iter iterator // 容器指针
#define FASTCpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lowbit(x) x & (-x)
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 2E5 + 5;
const int inf = (1 << 30);

int ax, ay, bx, by;
bool row = 0, colum = 0, rt;
int n, l, r, mid;
int res;
int main(){
//	FASTCpp
	ax = ay = bx = by = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cout << "? " << '1' << ' ' << i << ' ' << n << ' ' << i << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			colum = 1;
			if(!ay) ay = i;
			else{ by = i; break;}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << "? " << i << ' ' << '1' << ' ' << i << ' ' << n << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			row = 1;
			if(!ax) ax = i;
			else{ bx = i; break;}
		}
	}
	if(row && colum){
		cout << "? " << '1' << ' ' << '1' << ' ' << ax << ' ' << ay << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
		}else{
			cout << "! " << ax << ' ' << by << ' ' << bx << ' ' << ay << endl;
		}
		return 0;
	}
	l = 1, r = n;
	rt = 0;// go right / down
	while(1){
		mid = (l + r) >> 1;
		if(row){//same colum
			if(!rt){
				cout << "? " << ax << ' ' << l << ' ' << ax << ' ' << mid << endl;
			}else{
				cout << "? " << ax << ' ' << mid << ' ' << ax << ' ' << r << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == r){ay = by = l; break;}
				r = mid - 1;
				if(r < 1) r = 1;
				if(l > r) l = r;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > n) l = n;
				if(l > r) r = l;
			}
		}else{
			if(!rt){
				cout << "? " << l << ' ' << ay << ' ' << mid << ' ' << ay << endl;
			}else{
				cout << "? " << mid << ' ' << ay << ' ' << r << ' ' << ay << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == r){
					ax = bx = l;
					break;
				}
				r = mid - 1;
				if(r < 1) r = 1;
				if(l > r) l = r;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > n) l = n;
				if(l > r) r = l;
			}
		}
	}
	cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
	return 0 ;
}


#include <bits/stdc++.h>
#define ist insert
#define endl "\n"
#define pb push_back
#define iter iterator // 容器指针
#define FASTCpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lowbit(x) x & (-x)
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 2E5 + 5;
const int inf = (1 << 30);

int ax, ay, bx, by;
bool row = 0, colum = 0, rt;
int n, l, r, mid;
int res;
int main(){
//	FASTCpp
	ax = ay = bx = by = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cout << "? " << '1' << ' ' << i << ' ' << n << ' ' << i << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			colum = 1;
			if(!ay) ay = i;
			else{ by = i; break;}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << "? " << i << ' ' << '1' << ' ' << i << ' ' << n << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			row = 1;
			if(!ax) ax = i;
			else{ bx = i; break;}
		}
	}
	if(row && colum){
		cout << "? " << '1' << ' ' << '1' << ' ' << ax << ' ' << ay << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
		}else{
			cout << "! " << ax << ' ' << by << ' ' << bx << ' ' << ay << endl;
		}
		return 0;
	}
	l = 1, r = n;
	rt = 0;// go right / down
	while(1){
		mid = (l + r) >> 1;
		if(row){//same colum
			if(!rt){
				cout << "? " << ax << ' ' << l << ' ' << ax << ' ' << mid << endl;
			}else{
				cout << "? " << ax << ' ' << mid << ' ' << ax << ' ' << r << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == mid){ay = by = l; break;}
				r = mid - 1;
				if(r < 1) r = 1;
				if(l > r) l = r;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > n) l = n;
				if(l > r) r = l;
			}
		}else{
			if(!rt){
				cout << "? " << l << ' ' << ay << ' ' << mid << ' ' << ay << endl;
			}else{
				cout << "? " << mid << ' ' << ay << ' ' << r << ' ' << ay << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == mid){
					ax = bx = l;
					break;
				}
				r = mid - 1;
			//	if(r < 1) r = 1;
				if(l > r) l = r;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > n) l = n;
				if(l > r) r = l;
			}
		}
	}
	cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
	return 0 ;
}


#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define fi first
#define se second
#define del erase
#define ist insert
#define pb push_back
#define iter iterator // 容器指针 set
#define FASTCpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lowbit(x) x & (-x)
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 1E5 + 5;
const int inf = (1 << 30);
const int MOD = 1e9 + 7;
inline void OPEN(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
int ax, ay, bx, by;
bool row = 0, colum = 0, rt;
int n, l, r, mid;
int res;
int main(){
//	FASTCpp
	ax = ay = bx = by = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cout << "? " << '1' << ' ' << i << ' ' << n << ' ' << i << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			colum = 1;
			if(!ay) ay = i;
			else{ by = i; break;}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << "? " << i << ' ' << '1' << ' ' << i << ' ' << n << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			row = 1;
			if(!ax) ax = i;
			else{ bx = i; break;}
		}
	}
	if(row && colum){
		cout << "? " << '1' << ' ' << '1' << ' ' << ax << ' ' << ay << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
		}else{
			cout << "! " << ax << ' ' << by << ' ' << bx << ' ' << ay << endl;
		}
		return 0;
	}
	l = 1, r = n;
	rt = 0;// go right / down
	while(l <= r){
		mid = (l + r) >> 1;
		if(row){//same colum
			if(!rt){
				cout << "? " << ax << ' ' << l << ' ' << ax << ' ' << mid << endl;
			}else{
				cout << "? " << ax << ' ' << mid << ' ' << ax << ' ' << r << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				ay = by = l;
				r = mid - 1;
			}else{
				rt = 1;
				l = mid + 1;
			}
		}else{
			if(!rt){
				cout << "? " << l << ' ' << ay << ' ' << mid << ' ' << ay << endl;
			}else{
				cout << "? " << mid << ' ' << ay << ' ' << r << ' ' << ay << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				ax = bx = l;
				r = mid - 1;
			}else{
				rt = 1;
				l = mid + 1;
			}
		}
	}
	cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int x1, x2, y1, y2;
int res, n, cnt = 0, ax, ay, by, bx, mid;
bool Find, row, colum;
bool l;
int main(){
	FAST
	cin >> n;
	x1 = y1 = 1, x2 = n, y2 = 1;
	Find = row = colum = 0;
	ay = ax = by = bx = 0;
	l = 1;
	while(1){
		if(cnt < n + n){
			cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
		}else{
			if(row && colum){
				cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
			}else{
				if(row){
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << mid << endl;
					}else{
						cout << "? " << x1 << ' ' << mid << ' ' << x2 << ' ' << y2 << endl;
					}
				}else{
					//same row
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << mid << ' ' << y2 << endl;
					}else{
						cout << "? " << mid << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
					}
				}
			}
		}
		fflush(stdout);
		cin >> res;
		cnt++;
		if(cnt < n){
			if(res & 1){
				if(!ay) ay = y1;
				else by = y1;
				colum = 1;
			}
			++y1, ++y2;
		}else if(cnt <= n + n){
			if(cnt == n){
				if(res & 1){
					if(!ay) ay = y1;
					else by = y1;
					colum = 1;
				}
				y1 = 1, y2 = n, x2 = 1;
			}else if(cnt == n + n){
				if(res & 1){
					if(!ax) ax = x1;
					else bx = x1;
					row = 1;
				}
				if(row && colum){
					x1 = y1 = 1, x2 = ax, y2 = ay;
				}else{
					if(row){
						x1 = x2 = ax;
						y1 = 1, y2 = n;
						mid = (y1 + y2) / 2;
					}else{
						//same row
						y1 = y2 = ay;
						x1 = 1, x2 = n;
						mid = (x1 + x2) / 2;
					}
				}
			}else{
				if(res & 1){
					if(!ax) ax = x1;
					else bx = x1;
					row = 1;
				}
				++x1, ++x2;
			}
		}else{
			if(row && colum){
				Find = 1;
				if(res & 1){}
				else{
					swap(ay, by);
				}
			}else{
				l = 0;
				if(row){
					if(res & 1){
						l = 1;
						if(y1 == y2){
							Find = 1;
							ay = by = y1;
						}else{
							y2 = mid;
							mid = (y1 + y2) / 2;
						}
					}else{
						y1 = mid + 1;
						if(y1 > y2) y2 = y1;
						mid = (y1 + y2) / 2;
					}
				}else{
					l = 0;
					if(res & 1){
						l = 1;
						if(x1 == x2){
							Find = 1;
							ax = bx = x1;
						}else{
							x2 = mid;
							mid = (x1 + x2) / 2;
						}
					}else{
						x1 = mid + 1;
						if(x1 > x2) x2 = x1;
						mid = (x1 + x2) / 2;
					}
				}
			}
		}
		if(Find){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
			break;
		}
	}
	return 0;
}


#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define fi first
#define se second
#define del erase
#define ist insert
#define pb push_back
#define iter iterator // 容器指针 set
#define FASTCpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lowbit(x) x & (-x)
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 1E5 + 5;
const int inf = (1 << 30);
const int MOD = 1e9 + 7;
inline void OPEN(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
int ax, ay, bx, by;
bool row = 0, colum = 0, rt;
int n, l, r, mid;
int res;
int main(){
//	FASTCpp
	ax = ay = bx = by = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cout << "? " << '1' << ' ' << i << ' ' << n << ' ' << i << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			colum = 1;
			if(!ay) ay = i;
			else{ by = i; break;}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << "? " << i << ' ' << '1' << ' ' << i << ' ' << n << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			row = 1;
			if(!ax) ax = i;
			else{ bx = i; break;}
		}
	}
	if(row && colum){
		cout << "? " << '1' << ' ' << '1' << ' ' << ax << ' ' << ay << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
		}else{
			cout << "! " << ax << ' ' << by << ' ' << bx << ' ' << ay << endl;
		}
		return 0;
	}
	l = 1, r = n;
	while(l <= r){
		mid = (l + r) >> 1;
		if(row){//same colum
			cout << "? " << ax << ' ' << l << ' ' << ax << ' ' << mid << endl;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				ay = by = mid;
				r = mid - 1;
			}else{
				l = mid + 1;
			}
		}else{
			cout << "? " << l << ' ' << ay << ' ' << mid << ' ' << ay << endl;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				ax = bx = mid;
				r = mid - 1;
			}else{
				l = mid + 1;
			}
		}
	}
	cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
	return 0;
}


#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define fi first
#define se second
#define del erase
#define ist insert
#define pb push_back
#define iter iterator // 容器指针 set
#define FASTCpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lowbit(x) x & (-x)
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 1E5 + 5;
const int inf = (1 << 30);
const int MOD = 1e9 + 7;
inline void OPEN(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
int ax, ay, bx, by;
bool row = 0, colum = 0, rt;
int n, l, r, mid;
int res;
int main(){
//	FASTCpp
	ax = ay = bx = by = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cout << "? " << '1' << ' ' << i << ' ' << n << ' ' << i << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			colum = 1;
			if(!ay) ay = i;
			else{ by = i; break;}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << "? " << i << ' ' << '1' << ' ' << i << ' ' << n << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			row = 1;
			if(!ax) ax = i;
			else{ bx = i; break;}
		}
	}
	if(row && colum){
		cout << "? " << '1' << ' ' << '1' << ' ' << ax << ' ' << ay << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
		}else{
			cout << "! " << ax << ' ' << by << ' ' << bx << ' ' << ay << endl;
		}
		return 0;
	}
	l = 1, r = n;
	rt = 0;// go right / down
	while(l <= r){
		mid = (l + r) >> 1;
		if(row){//same colum
			if(!rt){
				cout << "? " << ax << ' ' << l << ' ' << ax << ' ' << mid << endl;
			}else{
				cout << "? " << ax << ' ' << mid << ' ' << ax << ' ' << r << endl;
			}
			fflush(stdout);
			cin >> res;
			rt = 0;
			if(res & 1){
				ay = by = mid;
				if(r == mid) break;
				r = mid;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > r) r = l;
			}
		}else{
			if(!rt){
				cout << "? " << l << ' ' << ay << ' ' << mid << ' ' << ay << endl;
			}else{
				cout << "? " << mid << ' ' << ay << ' ' << r << ' ' << ay << endl;
			}
			fflush(stdout);
			cin >> res;
			rt = 0;
			if(res & 1){
				ax = bx = mid;
				if(r == mid) break;
				r = mid;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > r) r = l;
			}
		}
	}
	cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define LL long long

LL x1, x2, y1, y2;
LL res, n, cnt = 0, ax, ay, by, bx, mid;
bool Find, row, colum;
bool l;
int main(){
	FAST
	cin >> n;
	x1 = y1 = 1, x2 = n, y2 = 1;
	Find = row = colum = 0;
	ay = ax = by = bx = 0;
	l = 1;
	while(1){
		if(cnt < n + n){
			cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
		}else{
			if(row && colum){
				cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
			}else{
				if(row){
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << x2 << ' ' << mid << endl;
					}else{
						cout << "? " << x1 << ' ' << mid << ' ' << x2 << ' ' << y2 << endl;
					}
				}else{
					//same row
					if(l){
						cout << "? " << x1 << ' ' << y1 << ' ' << mid << ' ' << y2 << endl;
					}else{
						cout << "? " << mid << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
					}
				}
			}
		}
		fflush(stdout);
		cin >> res;
		cnt++;
		if(cnt < n){
			if(res & 1){
				if(!ay) ay = y1;
				else{
					by = y1;
					cnt = n;
					y1 = 1, y2 = n, x2 = 1;
					continue;
				}
				colum = 1;
			}
			++y1, ++y2;
		}else if(cnt <= n + n){
			if(cnt == n){
				if(res & 1){
					if(!ay) ay = y1;
					else by = y1;
					colum = 1;
				}
				y1 = 1, y2 = n, x2 = 1;
			}else if(cnt == n + n){
				if(res & 1){
					if(!ax) ax = x1;
					else bx = x1;
					row = 1;
				}
				if(row && colum){
					x1 = y1 = 1, x2 = ax, y2 = ay;
				}else{
					if(row){
						x1 = x2 = ax;
						y1 = 1, y2 = n;
						mid = (y1 + y2) / 2;
					}else{
						//same row
						y1 = y2 = ay;
						x1 = 1, x2 = n;
						mid = (x1 + x2) / 2;
					}
				}
			}else{
				if(res & 1){
					if(!ax) ax = x1;
					else{
						bx = x1;
						cnt = n + n;
						if(row && colum){
							x1 = y1 = 1, x2 = ax, y2 = ay;
						}else{
							if(row){
								x1 = x2 = ax;
								y1 = 1, y2 = n;
								mid = (y1 + y2) / 2;
							}else{
								//same row
								y1 = y2 = ay;
								x1 = 1, x2 = n;
								mid = (x1 + x2) / 2;
							}
						}
						continue;
					}
					row = 1;
				}
				++x1, ++x2;
			}
		}else{
			if(row && colum){
				Find = 1;
				if(res & 1){}
				else{
					swap(ay, by);
				}
			}else{
				l = 0;
				if(row){
					if(res & 1){
						l = 1;
						if(y1 == y2){
							Find = 1;
							ay = by = y1;
						}else{
							y2 = mid;
							mid = (y1 + y2) / 2;
						}
					}else{
						y1 = mid + 1;
						if(y1 > y2) y2 = y1;
						mid = (y1 + y2) / 2;
					}
				}else{
					l = 0;
					if(res & 1){
						l = 1;
						if(x1 == x2){
							Find = 1;
							ax = bx = x1;
						}else{
							x2 = mid;
							mid = (x1 + x2) / 2;
						}
					}else{
						x1 = mid + 1;
						if(x1 > x2) x2 = x1;
						mid = (x1 + x2) / 2;
					}
				}
			}
		}
		if(Find){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
			break;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define ist insert
#define endl "\n"
#define pb push_back
#define iter iterator // 容器指针
#define FASTCpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lowbit(x) x & (-x)
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 2E5 + 5;
const int inf = (1 << 30);

int ax, ay, bx, by;
bool row = 0, colum = 0, rt;
int n, l, r, mid;
int res;
int main(){
//	FASTCpp
	ax = ay = bx = by = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cout << "? " << '1' << ' ' << i << ' ' << n << ' ' << i << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			colum = 1;
			if(!ay) ay = i;
			else{ by = i; break;}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << "? " << i << ' ' << '1' << ' ' << i << ' ' << n << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			row = 1;
			if(!ax) ax = i;
			else{ bx = i; break;}
		}
	}
	if(row && colum){
		cout << "? " << '1' << ' ' << '1' << ' ' << ax << ' ' << ay << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
		}else{
			cout << "! " << ax << ' ' << by << ' ' << bx << ' ' << ay << endl;
		}
		return 0;
	}
	l = 1, r = n;
	rt = 0;// go right / down
	while(1){
		mid = (l + r) >> 1;
		if(row){//same colum
			if(!rt){
				cout << "? " << ax << ' ' << l << ' ' << ax << ' ' << mid << endl;
			}else{
				cout << "? " << ax << ' ' << mid << ' ' << ax << ' ' << r << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == r){ay = by = l; break;}
				r = mid - 1;
				if(l > r) r = l;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > r) r = l;
			}
		}else{
			if(!rt){
				cout << "? " << l << ' ' << ay << ' ' << mid << ' ' << ay << endl;
			}else{
				cout << "? " << mid << ' ' << ay << ' ' << r << ' ' << ay << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == r){
					ax = bx = l;
					break;
				}
				r = mid - 1;
				if(l > r) r = l;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > r) r = l;
			}
		}
	}
	cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
	return 0 ;
}


#include <bits/stdc++.h>
#define ist insert
#define endl "\n"
#define pb push_back
#define iter iterator // 容器指针
#define FASTCpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lowbit(x) x & (-x)
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 2E5 + 5;
const int inf = (1 << 30);

int ax, ay, bx, by;
bool row = 0, colum = 0, rt;
int n, l, r, mid;
int res;
int main(){
//	FASTCpp
	ax = ay = bx = by = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cout << "? " << '1' << ' ' << i << ' ' << n << ' ' << i << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			colum = 1;
			if(!ay) ay = i;
			else{ by = i; break;}
		}
	}
	for(int i = 1; i <= n; i++){
		cout << "? " << i << ' ' << '1' << ' ' << i << ' ' << n << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			row = 1;
			if(!ax) ax = i;
			else{ bx = i; break;}
		}
	}
	if(row && colum){
		cout << "? " << '1' << ' ' << '1' << ' ' << ax << ' ' << ay << endl;
		fflush(stdout);
		cin >> res;
		if(res & 1){
			cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
		}else{
			cout << "! " << ax << ' ' << by << ' ' << bx << ' ' << ay << endl;
		}
		return 0;
	}
	l = 1, r = n;
	rt = 0;// go right / down
	while(1){
		mid = (l + r) >> 1;
		if(row){//same colum
			if(!rt){
				cout << "? " << ax << ' ' << l << ' ' << ax << ' ' << mid << endl;
			}else{
				cout << "? " << ax << ' ' << mid << ' ' << ax << ' ' << r << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == r){ay = by = l; break;}
				r = mid;
			//	if(r < 1) r = 1;
				if(l > r) l = r;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > n) l = n;
				if(l > r) r = l;
			}
		}else{
			if(!rt){
				cout << "? " << l << ' ' << ay << ' ' << mid << ' ' << ay << endl;
			}else{
				cout << "? " << mid << ' ' << ay << ' ' << r << ' ' << ay << endl;
			}
			rt = 0;
			fflush(stdout);
			cin >> res;
			if(res & 1){
				if(l == r){
					ax = bx = l;
					break;
				}
				r = mid;
			//	if(r < 1) r = 1;
				if(l > r) l = r;
			}else{
				rt = 1;
				l = mid + 1;
				if(l > n) l = n;
				if(l > r) r = l;
			}
		}
	}
	cout << "! " << ax << ' ' << ay << ' ' << bx << ' ' << by << endl;
	return 0 ;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout.flush(); fflush(stdout);
    cout<<"! "<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x%2==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout.flush(); fflush(stdout);
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cout.flush(); fflush(stdout);
                cin>>x; if(x==-1){ cout<<"!";return ;}
                cout.flush(); fflush(stdout);
                if(x%2==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<i<<' '<<n<<' '<<i<<'\n';
            cout.flush(); fflush(stdout);
            fflush(stdout);
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush(); fflush(stdout);
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout.flush(); fflush(stdout);
        cout<<"? "<<i<<" 1 "<<i<<' '<<n<<'\n';
        cin>>Lin[i];
        cout.flush(); fflush(stdout);
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush(); fflush(stdout);
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout.flush();
    cout<<'!'<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush();
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cout.flush();
            cin>>x;
            cout.flush();
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush();
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cout.flush();
            cin>>x;
            cout.flush();
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout.flush();
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cout.flush();
                cin>>x;
                cout.flush();
                if(x==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout.flush();
            cout<<"? 1 "<<i<<' '<<n<<' '<<i;
            cout.flush();
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush();
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout.flush();
        cout<<"? "<<i<<" 1 "<<i<<' '<<n;
        cin>>Lin[i];
        cout.flush();
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush();
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout.flush(); fflush(stdout);
    cout<<"! "<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout.flush(); fflush(stdout);
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cout.flush(); fflush(stdout);
                cin>>x; if(x==-1){ cout<<"!";return ;}
                cout.flush(); fflush(stdout);
                if(x==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<i<<' '<<n<<' '<<i<<'\n';
            cout.flush(); fflush(stdout);
            fflush(stdout);
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush(); fflush(stdout);
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout.flush(); fflush(stdout);
        cout<<"? "<<i<<" 1 "<<i<<' '<<n<<'\n';
        cin>>Lin[i];
        cout.flush(); fflush(stdout);
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush(); fflush(stdout);
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout.flush(); fflush(stdout);
    cout<<"! "<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x%2==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x%2==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout.flush(); fflush(stdout);
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cout.flush(); fflush(stdout);
                cin>>x; if(x==-1){ cout<<"!";return ;}
                cout.flush(); fflush(stdout);
                if(x%2==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<i<<' '<<n<<' '<<i<<'\n';
            cout.flush(); fflush(stdout);
            fflush(stdout);
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush(); fflush(stdout);
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout.flush(); fflush(stdout);
        cout<<"? "<<i<<" 1 "<<i<<' '<<n<<'\n';
        cin>>Lin[i];
        cout.flush(); fflush(stdout);
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush(); fflush(stdout);
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout.flush(); fflush(stdout);
    cout<<'!'<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout.flush(); fflush(stdout);
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cout.flush(); fflush(stdout);
                cin>>x; if(x==-1){ cout<<"!";return ;}
                cout.flush(); fflush(stdout);
                if(x==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<i<<' '<<n<<' '<<i<<'\n';
            cout.flush(); fflush(stdout);
            fflush(stdout);
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush(); fflush(stdout);
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout.flush(); fflush(stdout);
        cout<<"? "<<i<<" 1 "<<i<<' '<<n<<'\n';
        cin>>Lin[i];
        cout.flush(); fflush(stdout);
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush(); fflush(stdout);
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout.flush(); fflush(stdout);
    cout<<'!'<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush(); fflush(stdout);
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cout.flush(); fflush(stdout);
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush(); fflush(stdout);
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout.flush(); fflush(stdout);
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cout.flush(); fflush(stdout);
                cin>>x; if(x==-1){ cout<<"!";return ;}
                cout.flush(); fflush(stdout);
                if(x==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout.flush(); fflush(stdout);
            cout<<"? 1 "<<i<<' '<<n<<' '<<i;
            cout.flush(); fflush(stdout);
            fflush(stdout);
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush(); fflush(stdout);
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout.flush(); fflush(stdout);
        cout<<"? "<<i<<" 1 "<<i<<' '<<n;
        cin>>Lin[i];
        cout.flush(); fflush(stdout);
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush(); fflush(stdout);
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout<<'!'<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cin>>x;
            cout.flush();
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cin>>x;
            cout.flush();
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cin>>x;
                cout.flush();
                if(x==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout<<"? 1 "<<i<<' '<<n<<' '<<i;
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush();
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout<<"? "<<i<<" 1 "<<i<<' '<<n;
        cin>>Lin[i];
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush();
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <iostream>
#define MAX 1005
using namespace std;
int n,Col[MAX],Lin[MAX],x1,y1,x2,y2,L[3],C[3],a,b,Sum;
void citire(),rezolv();
int main(){
    citire();
    rezolv();
    cout.flush();
    cout<<'!'<<x1<<' '<<y1<<' ';
    cout<<x2<<' '   <<y2<<'\n';
    return 0;
}
void rezolv(){
    int i,j,st=1,dr=n,mij,x,linie=L[0],coloana=C[0],ans;
    if(!a){//nu am gasit coloana
        x1=L[0];x2=L[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush();
            cout<<"? 1 "<<st<<' '<<linie<<' '<<mij<<'\n';
            cout.flush();
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush();
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        y1=y2=ans;
    }else if(!b){//nu am gasit linie
        y1=C[0];y2=C[1];
        while(dr>=st){
            mij=(st+dr)>>1;
            cout.flush();
            cout<<"? "<<st<<" 1 "<<mij<<' '<<coloana<<'\n';
            cout.flush();
            cin>>x; if(x==-1){ cout<<"!";return ;}
            cout.flush();
            if(x==1){
                dr=mij-1;
                ans=mij;
            }
            else st=mij+1;
        }
        x1=x2=ans;
    }else{//bun
        for(i=0;i<a;++i){
            for(j=0;j<b;++j){
                cout.flush();
                cout<<"? "<<L[j]<<' '<<C[i]<<' '<<L[j]<<' '<<C[i]<<'\n';
                cout.flush();
                cin>>x; if(x==-1){ cout<<"!";return ;}
                cout.flush();
                if(x==1){
                    if(x1==0){
                        x1=L[j];
                        y1=C[i];
                    }else{
                        x2=L[j];
                        y2=C[i];
                    }
                }
            }
        }
    }
}
void citire(){
    int i;
    cin>>n;
    for(i=1;i<n;++i){//coloane
            cout.flush();
            cout<<"? 1 "<<i<<' '<<n<<' '<<i;
            cout.flush();
            cin>>Col[i];
            Sum=(Sum+Col[i])%2;
            if(Col[i]%2)C[a++]=i;
            cout.flush();
    }
    Col[n]=Sum;
    if(Sum%2)C[a++]=n;
    Sum=0;
    for(i=1;i<n;++i){
        cout.flush();
        cout<<"? "<<i<<" 1 "<<i<<' '<<n;
        cin>>Lin[i];
        cout.flush();
        Sum=(Sum+Lin[i])%2;
        if(Lin[i]%2)L[b++]=i;
        cout.flush();
    }
    Lin[n]=Sum;
    if(Sum%2)L[b++]=n;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans(2);

int ask(int x, int y, int xx, int yy) {
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans[0].fi = x;
		ans[1].fi = x;
		return;
	}
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans[0].se = x;
		ans[1].se = x;
		return;
	}
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	int ind = 0;
	for(int i = 1; i <= n; i++)
		if(ask(1, st, n, i) % 2 == 1) {
			st = i + 1;
			ans[ind++].se = i;
		}
	st = 1;
	ind = 0;
	for(int i = 1; i <= n; i++)
		if(ask(st, 1, i, n) % 2 == 1) {
			st = i + 1;
			ans[ind++].fi = i;
		}

	if(ans[0].fi == 0)
		bs1(ans[0].se, 1, n);
	else if(ans[0].se == 0)
		bs2(ans[0].fi, 1, n);
	else
		if(ask(ans[0].fi, ans[0].se, ans[0].fi, ans[0].se) % 2 != 1 || ask(ans[1].fi, ans[1].se, ans[1].fi, ans[1].se) % 2 != 1)
			swap(ans[0].fi, ans[1].fi);
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y + 1) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k;
vector<ii> ans;

int ask(int x, int y, int xx, int yy) {
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}

	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}

	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
		}
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}
	st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
		}
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans(2);

int ask(int x, int y, int xx, int yy) {
	assert(x <= xx && y <= yy);
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans[0].fi = x;
		ans[1].fi = x;
		return;
	}
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans[0].se = x;
		ans[1].se = x;
		return;
	}
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	int ind = 0;
	for(int i = 1; i <= n; i++)
		if(ask(1, st, n, i) % 2 == 1) {
			st = i + 1;
			ans[ind++].se = i;
		}
	st = 1;
	ind = 0;
	for(int i = 1; i <= n; i++)
		if(ask(st, 1, i, n) % 2 == 1) {
			st = i + 1;
			ans[ind++].fi = i;
		}

	if(ans[0].fi == 0)
		bs1(ans[0].se, 1, n);
	else if(ans[0].se == 0)
		bs2(ans[0].fi, 1, n);
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y - 1) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k;
vector<ii> ans;

int ask(int x, int y, int xx, int yy) {
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x > y) {
		ans.pb({x, col});
		return;
	}

	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x > y) {
		ans.pb({row, x});
		return;
	}

	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
		}
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}
	st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
		}
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans;

int ask(int x, int y, int xx, int yy) {
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}
	tot++;
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}
	tot++;
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			cerr << tot;
			st = i + 1;
		}
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}
	st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
		}
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans;
map<pair<ii, ii>, int> mpx;

int ask(int x, int y, int xx, int yy) {
	if(mpx.count({{x, y}, {xx, yy}}) != 0) {
		assert(0);
		return mpx[{{x, y}, {xx, yy}}];
	}
	assert(tot != 2019);
	tot++;
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	mpx[{{x, y}, {xx, yy}}] = re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	bool fl = false;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs1(i, 1, n);
			break;
		}
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}

	st = 1;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs2(i, 1, n);
			break;
		}
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans;
map<pair<ii, ii>, int> mpx;

int ask(int x, int y, int xx, int yy) {
	if(mpx.count({{x, y}, {xx, yy}}) != 0)
		return mpx[{{x, y}, {xx, yy}}];
	assert(tot != 2019);
	tot++;
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	mpx[{{x, y}, {xx, yy}}] = re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	bool fl = false;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs1(i, 1, n);
			break;
		}
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}

	st = 1;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs2(i, 1, n);
			break;
		}
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans;
map<pair<ii, ii>, int> mpx;

int ask(int x, int y, int xx, int yy) {
	if(mpx.count({{x, y}, {xx, yy}}) != 0)
		return mpx[{{x, y}, {xx, yy}}];
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	mpx[{{x, y}, {xx, yy}}] = re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}
	tot++;
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}
	tot++;
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	bool fl = false;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs1(i, 1, n);
			break;
		}
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	assert(tot <= 20);
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}

	st = 1;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs2(i, 1, n);
			break;
		}
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	assert(tot <= 20);
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans;

int ask(int x, int y, int xx, int yy) {
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}
	tot++;
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}
	tot++;
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	bool fl = false;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs1(i, 1, n);
			break;
		}
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}

	st = 1;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs2(i, 1, n);
			break;
		}
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k, tot;
vector<ii> ans;
map<pair<ii, ii>, int> mpx;

int ask(int x, int y, int xx, int yy) {
	if(mpx.count({{x, y}, {xx, yy}}) != 0)
		return mpx[{{x, y}, {xx, yy}}];
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	mpx[{{x, y}, {xx, yy}}] = re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}
	tot++;
	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}
	tot++;
	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	bool fl = false;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs1(i, 1, n);
			break;
		}
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	assert(tot <= 22);
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}

	st = 1;
	for(int i = 1; i <= n; i++) {
		if(fl && ans.size() == 1 && i == n) {
			bs2(i, 1, n);
			break;
		}
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
			fl = true;
		}
	}
	assert(tot <= 22);
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}


#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, k;
vector<ii> ans;

int ask(int x, int y, int xx, int yy) {
	int re;
	cout << "?" << spc << x << spc << y << spc << xx << spc << yy << endl << flush;
	cin >> re;
	return re;
}

void bs1(int col, int x, int y) {
	if(x >= y) {
		ans.pb({x, col});
		return;
	}

	if(ask(1, col, mid, col) % 2 == 1)
		bs1(col, x, mid);
	else
		bs1(col, mid + 1, y);
}

void bs2(int row, int x, int y) {
	if(x >= y) {
		ans.pb({row, x});
		return;
	}

	if(ask(row, 1, row, mid) % 2 == 1)
		bs2(row, x, mid);
	else
		bs2(row, mid + 1, y);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;

	int st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(1, st, n, i) % 2 == 1) {
			bs1(i, 1, n);
			st = i + 1;
		}
	if(ans.size() == 2) {
		cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
		return 0;
	}
	st = 1;
	for(int i = 1; i <= n; i++)
		if(ask(st, 1, i, n) % 2 == 1) {
			bs2(i, 1, n);
			st = i + 1;
		}
	cout << "!" << spc << ans[0].fi << spc << ans[0].se << spc << ans[1].fi << spc << ans[1].se << endl << flush;
}