#include <bits/stdc++.h>
using namespace std;
#define int  long long int
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min3(a,b,c) min(a,min(b,c))
#define mai3(a,b,c) mai(a,mai(b,c))
#define all(i) i.begin(),i.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define set_bit __builtin_popcount //gives number of set_bits
#define ff first
#define ss second
#define cases(t) int t;cin>>t; rep(casn,1,t+1)
#define el cout<<"\n";
#define deci(n) int n; scanf("%lld",&n);
#define decs(n) string n; cin>>n;
#define sz(v) v.size()
#define repit(m)  for(itx=m.begin();itx!=m.end();itx++)
#define ins insert
 #define INF 1000000000000000000
 #define NP 50000

//  cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";

//  IIITA
//SUNEET KUMAR -->  ਸੁਨੀਤ
 int power(int a,int x)
 {
         a%=mod;
        int res=1;
    while(x>0)
        {
            if(x&1)
            res=res*a%mod;
            a=a*a%mod;
            x>>=1;
        }
    return res;
}
int mai(int a,int b)
{
    if(a>b)
    {
        return a;
    }
    else
    {
        return b;
    }
}
int madd(int a,int b)
{
    int ans;
    ans=(a%mod+b%mod)%mod;
    return ans;
}
int mmult(int a,int b)
{
    int ans=1;
    ans=((a%mod)*(b%mod))%mod;
    return ans%mod;
}
int modinverse(int a)
{
    return power(a,mod-2);
}
vector<int>v[1005];
int visit[1005],level[1005];
void bfs(int s)
{
    visit[s]=1;
    level[s]=1;
    queue<int>q;
    q.push(s);
    while(!q.empty())
    {
        int p=q.front();
        q.pop();
        for(int i=0;i<v[p].size();i++)
        {
            if(visit[v[p][i]]==0)
            {
                visit[v[p][i]]=1;
                level[v[p][i]]=level[p]+1;
            }
        }
    }
}
int mark[10004];
void remo(int s)
{
  for(int i=1;i<=n;i++)
  {
    if(i==s)
    {
      v[s].clear();
    }
    else
    {
      repit(v[i])
      {
        v[i].erase(it);
        break;
      }
    }
  }
}

signed main()
{
    std::vector<int> ::iterator itx;
    int n;cin>>n;
    for(int i=1;i<n;i++)
    {
        int x,y;cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    // vector<int>leaf;
    vector<int>t_leaf;
    vector<int>leaf;
    int sta;
    for(int i=1;i<=n;i++)
    {
        if(v[i].size()==1)
        {
          sta=i;
            t_leaf.pb(i);
            leaf.pb(i);
        }
    }

    int ans=1;
    int x=n/2;
    vector<int>xx;

    // el
    while(x--)
    {
        if(leaf.size()>=2)
        {
            vector<int>::iterator  it=leaf.begin();
            int x1=*it;
            it++;
            int x2=*it;

            cout<<"? "<<x1<<" "<<x2;el
            int z;cin>>z;
            ans=z;
                if(x1==z||x2==z)
                {
                    ans=z;
                    break;
                }
                 if(v[ans].size()<=1)
                 {
                    leaf.pb(ans);
                 }
                leaf.erase(leaf.begin());
                leaf.erase(leaf.begin());
        }

    }
    if(leaf.size()==1)
    {
      ans=leaf[0];
    }

    cout<<"! "<<ans;el
}


#include <bits/stdc++.h>
using namespace std;
#define int  long long int
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min3(a,b,c) min(a,min(b,c))
#define mai3(a,b,c) mai(a,mai(b,c))
#define all(i) i.begin(),i.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define set_bit __builtin_popcount //gives number of set_bits
#define ff first
#define ss second
#define cases(t) int t;cin>>t; rep(casn,1,t+1)
#define el cout<<"\n";
#define deci(n) int n; scanf("%lld",&n);
#define decs(n) string n; cin>>n;
#define sz(v) v.size()
#define repit(m)  for(itx=m.begin();itx!=m.end();itx++)
#define ins insert
 #define INF 1000000000000000000
 #define NP 50000

//  cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";

//  IIITA
//SUNEET KUMAR -->  ਸੁਨੀਤ
 int power(int a,int x)
 {
         a%=mod;
        int res=1;
    while(x>0)
        {
            if(x&1)
            res=res*a%mod;
            a=a*a%mod;
            x>>=1;
        }
    return res;
}
int mai(int a,int b)
{
    if(a>b)
    {
        return a;
    }
    else
    {
        return b;
    }
}
int madd(int a,int b)
{
    int ans;
    ans=(a%mod+b%mod)%mod;
    return ans;
}
int mmult(int a,int b)
{
    int ans=1;
    ans=((a%mod)*(b%mod))%mod;
    return ans%mod;
}
int modinverse(int a)
{
    return power(a,mod-2);
}
vector<int>v[1005];
int visit[1005],level[1005];
void bfs(int s)
{
    visit[s]=1;
    level[s]=1;
    queue<int>q;
    q.push(s);
    while(!q.empty())
    {
        int p=q.front();
        q.pop();
        for(int i=0;i<v[p].size();i++)
        {
            if(visit[v[p][i]]==0)
            {
                visit[v[p][i]]=1;
                level[v[p][i]]=level[p]+1;
            }
        }
    }
}

int mark[10004];
int n;
void remo(int s)
{
  for(int i=1;i<=n;i++)
  {
    if(i==s)
    {
      v[s].clear();
    }
    else
    {
      std::vector<int> ::iterator itx;
      for(itx=v[i].begin();itx!=v[i].end();itx++)
      {
        if(*itx==s)
        v[i].erase(itx);
      }

    }

  }

}

signed main()
{
    // std::vector<int> ::iterator itx;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        int x,y;cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    // vector<int>leaf;
    vector<int>t_leaf;
    vector<int>leaf;
    int sta;
    for(int i=1;i<=n;i++)
    {
        if(v[i].size()==1)
        {
          sta=i;
            t_leaf.pb(i);
            leaf.pb(i);
        }
    }

    int ans=1;
    int x=n/2;
    vector<int>xx;

    // el
    while(x--)
    {
        if(leaf.size()>=2)
        {
            vector<int>::iterator  it=leaf.begin();
            int x1=*it;
            it++;
            int x2=*it;

            cout<<"? "<<x1<<" "<<x2;el
            int z;cin>>z;
            ans=z;
                if(x1==z||x2==z)
                {
                    ans=z;
                    break;
                }

                 remo(x1);remo(x2);
                  if(v[ans].size()<=1)
                 {
                    leaf.pb(ans);
                 }
                leaf.erase(leaf.begin());
                leaf.erase(leaf.begin());
        }
    }
    if(leaf.size()==1)
    {
      ans=leaf[0];
    }

    cout<<"! "<<ans;el
}


#include <bits/stdc++.h>
using namespace std;
#define int  long long int
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min3(a,b,c) min(a,min(b,c))
#define mai3(a,b,c) mai(a,mai(b,c))
#define all(i) i.begin(),i.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define set_bit __builtin_popcount //gives number of set_bits
#define ff first
#define ss second
#define cases(t) int t;cin>>t; rep(casn,1,t+1)
#define el cout<<"\n";
#define deci(n) int n; scanf("%lld",&n);
#define decs(n) string n; cin>>n;
#define sz(v) v.size()
#define repit(m)  for(itx=m.begin();itx!=m.end();itx++)
#define ins insert
 #define INF 1000000000000000000
 #define NP 50000

//  cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";

//  IIITA
//SUNEET KUMAR -->  ਸੁਨੀਤ
 int power(int a,int x)
 {
         a%=mod;
        int res=1;
    while(x>0)
        {
            if(x&1)
            res=res*a%mod;
            a=a*a%mod;
            x>>=1;
        }
    return res;
}
int mai(int a,int b)
{
    if(a>b)
    {
        return a;
    }
    else
    {
        return b;
    }
}
int madd(int a,int b)
{
    int ans;
    ans=(a%mod+b%mod)%mod;
    return ans;
}
int mmult(int a,int b)
{
    int ans=1;
    ans=((a%mod)*(b%mod))%mod;
    return ans%mod;
}
int modinverse(int a)
{
    return power(a,mod-2);
}
vector<int>v[1005];
int visit[1005],level[1005];
void bfs(int s)
{
    visit[s]=1;
    level[s]=1;
    queue<int>q;
    q.push(s);
    while(!q.empty())
    {
        int p=q.front();
        q.pop();
        for(int i=0;i<v[p].size();i++)
        {
            if(visit[v[p][i]]==0)
            {
                visit[v[p][i]]=1;
                level[v[p][i]]=level[p]+1;
            }
        }
    }
}

int mark[10004];
int n;
void remo(int s)
{
  for(int i=1;i<=n;i++)
  {
    if(i==s)
    {
      v[s].clear();
    }
    else
    {
      std::vector<int> ::iterator itx;
      for(itx=v[i].begin();itx!=v[i].end();itx++)
      {
        if(*itx==s)
        v[i].erase(itx);
      }

    }

  }

}

signed main()
{
    // std::vector<int> ::iterator itx;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        int x,y;cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    // vector<int>leaf;
    vector<int>t_leaf;
    vector<int>leaf;
    int sta;
    for(int i=1;i<=n;i++)
    {
        if(v[i].size()==1)
        {
          sta=i;
            t_leaf.pb(i);
            leaf.pb(i);
        }
    }

    int ans=1;
    int x=n/2;
    vector<int>xx;

    // el
    while(x--)
    {
        if(leaf.size()>=2)
        {
            vector<int>::iterator  it=leaf.begin();
            int x1=*it;
            it++;
            int x2=*it;

            cout<<"? "<<x1<<" "<<x2;el
            int z;cin>>z;
            ans=z;
                if(x1==z||x2==z)
                {
                    ans=z;
                    break;
                }

                 remo(x1);remo(x2);
                  if(v[ans].size()<=1)
                 {
                    leaf.pb(ans);
                 }
                leaf.erase(leaf.begin());
                leaf.erase(leaf.begin());
        }
        else
        {
          break;
        }
    }
    if(leaf.size()==1)
    {
      ans=leaf[0];
    }

    cout<<"! "<<ans;el
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0,hash[n+1]={0},c1,c2,pc1,pc2,c3=0;
		//int *x;
		vector<int>g[n+1],v;
		fr(i,n-1)
		{
			cin>>u>>V;
			//u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		/*queue<int>q;
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				//v[g[i][0]].pb(i);
				q.push(i+1);
				hash[i+1]++;
			}
		}
		i=0;
		while(i<=n/2&&!q.empty())
		{
			u=q.front();
			hash[u]--;
			q.pop();
			if(q.empty()){cout<<"! "<<u<<"\n"; cout.flush(); i--; break;}
			if(i==n/2){cout<<"-1\n"; break;}
			v=q.front();
			q.pop();
			hash[v]--;
			cout<<"? "<<u<<" "<<v<<"\n";
			cout.flush();
			cin>>w;
			c1=g[u-1].size();
			c2=g[v-1].size();
			c3=g[w-1].size();
			if(c1==c2&&c2==1){cout<<"! "<<w<<"\n"; break;}
			if(!hash[w]){q.push(w); hash[w]++;}
			i++;
		}*/
		for(i=1;i<=n;i++)
		{
			if(g[i].size()==1)
			{
				v.pb(i);
				hash[i]++;
			}
		}
		while(c3<n/2&&(v.size())>1)
		{
			c1=v[0];
			c2=v[1];
			cout<<"? "<<c2<<" "<<c1<<"\n";
			v.erase(v.begin(),v.begin()+2);
			cout.flush();
			cin>>w;
			if(w==c1||w==c2)
			{
				cout<<"! "<<w<<"\n";
				break;
			}
			pc1=g[c1][0];
			pc2=g[c2][0];
			//if(g[pc1].size()==2&&hash[pc1]==0){v.pb(pc1); hash[pc1]++;}
			//if(g[pc2].size()==2&&hash[pc2]==0){v.pb(pc2); hash[pc2]++;}
			//for(auto x:g[pc1]){if(x==c1){g[pc1].erase(x,x+1); break;}}
			//g[pc1].erase(x);
			for(i=0;i<(g[pc1].size());i++){if(g[pc1][i]==c1)break;}
			g[pc1].erase(g[pc1].begin()+i,g[pc1].begin()+i+1);
			if(g[pc1].size()==1&&hash[pc1]==0){v.pb(pc1); hash[pc1]++;}
			for(i=0;i<(g[pc2].size());i++){if(g[pc2][i]==c2)break;}
			g[pc2].erase(g[pc2].begin()+i,g[pc2].begin()+i+1);
			if(g[pc2].size()==1&&hash[pc2]==0){v.pb(pc2); hash[pc2]++;}
			if(g[w].size()==1&&!hash[w]){v.pb(w); hash[w]++;}
			c3++;
		}
		if(v.size()==1)cout<<"! "<<v[0]<<"\n";
		else if(c3==n/2)cout<<"-1\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			cout<<"! "<<i+1<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,v,V,w,j=0,hash[n+1]={0};
		vector<int>g[n];
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		queue<int>q;
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				//v[g[i][0]].pb(i);
				q.push(i+1);
				hash[i+1]++;
			}
		}
		i=0;
		while(i<=n/2&&!q.empty())
		{
			u=q.front();
			hash[u]--;
			q.pop();
			if(q.empty()){cout<<"! "<<u<<"\n"; cout.flush(); i--; break;}
			if(i==n/2){break;}
			v=q.front();
			q.pop();
			hash[v]--;
			cout<<"? "<<u<<" "<<v<<"\n";
			cout.flush();
			cin>>w;
			if(!hash[w]){q.push(w); hash[w]++;}
			i++;
		}
		if(i==n/2){cout<<"-1\n"; cout.flush();}
	}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		/*fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			int c=0;
			i++;
			for(j=1;j<=n;j+=2)
			{
				if(j==n){j--;}
				if(j==i)
				{
					if(j+2<=n){
						j++;
						cout<<"? "<<j<<" "<<j+1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+1){c=1;break;}
					}
					else
					{
						cout<<"? "<<n<<" "<<n-2<<"\n";
						cout.flush();
						cin>>w;
						if(w==n){c=1;break;}
						j++;
					}
				}
				else if(j+1==i)
				{
					if(i<n){
						cout<<"? "<<j<<" "<<j+2<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+2){c=1;break;}
						j++;
					}
					else
					{
						cout<<"? "<<j<<" "<<j-1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j){c=1; break;}
						j++;
					}
				}
				else
				{
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+1){c=1; break;}
				}
			}
			if(c)cout<<"! "<<w<<"\n";
			else cout<<"! "<<i<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}*/
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			if(w==v1[j]||w==v1[j+1])break;
			j++;
			i++;
			v1[j]=w;
		}
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			cout<<"! "<<i+1<<"\n";
		}
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,v,V,w,j=0,hash[n+1]={0},c1,c2;
		vector<int>g[n];
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		queue<int>q;
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				//v[g[i][0]].pb(i);
				q.push(i+1);
				hash[i+1]++;
			}
		}
		i=0;
		while(i<=n/2&&!q.empty())
		{
			u=q.front();
			hash[u]--;
			q.pop();
			if(q.empty()){cout<<"! "<<u<<"\n"; cout.flush(); i--; break;}
			if(i==n/2){cout<<"-1\n"; break;}
			v=q.front();
			q.pop();
			hash[v]--;
			cout<<"? "<<u<<" "<<v<<"\n";
			cout.flush();
			cin>>w;
			c1=g[u-1].size();
			c2=g[v-1].size();
			c3=g[w-1].size();
			if(c1==c2&&c2==1){cout<<"! "<<w<<"\n"; break;}
			if(!hash[w]){q.push(w); hash[w]++;}
			i++;
		}
		//if(i==n/2){cout<<"-1\n"; cout.flush();}
	}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		/*fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			int c=0;
			i++;
			for(j=1;j<=n;j+=2)
			{
				if(j==n){j--;}
				if(j==i)
				{
					if(j+2<=n){
						j++;
						cout<<"? "<<j<<" "<<j+1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+1){c=1;break;}
					}
					else
					{
						cout<<"? "<<n<<" "<<n-2<<"\n";
						cout.flush();
						cin>>w;
						if(w==n){c=1;break;}
						j++;
					}
				}
				else if(j+1==i)
				{
					if(i<n){
						cout<<"? "<<j<<" "<<j+2<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+2){c=1;break;}
						j++;
					}
					else
					{
						cout<<"? "<<j<<" "<<j-1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j){c=1; break;}
						j++;
					}
				}
				else
				{
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+1){c=1; break;}
				}
			}
			if(c)cout<<"! "<<w<<"\n";
			else cout<<"! "<<i<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}*/
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			if(w==v1[j]||w==v1[j+1])break;
			j++;
			i++;
			v1[j]=w;
		}
		if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,v,V,w,j=0,hash[n+1]={0},c1,c2,c3;
		vector<int>g[n];
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		queue<int>q;
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				//v[g[i][0]].pb(i);
				q.push(i+1);
				hash[i+1]++;
			}
		}
		i=0;
		while(i<=n/2&&!q.empty())
		{
			u=q.front();
			hash[u]--;
			q.pop();
			if(q.empty()){cout<<"! "<<u<<"\n"; cout.flush(); i--; break;}
			if(i==n/2){cout<<"-1\n"; break;}
			v=q.front();
			q.pop();
			hash[v]--;
			cout<<"? "<<u<<" "<<v<<"\n";
			cout.flush();
			cin>>w;
			c1=g[u-1].size();
			c2=g[v-1].size();
			c3=g[w-1].size();
			if(c1==c2&&c2==1){cout<<"! "<<w<<"\n"; break;}
			if(!hash[w]){q.push(w); hash[w]++;}
			i++;
		}
		//if(i==n/2){cout<<"-1\n"; cout.flush();}
	}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		/*fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			int c=0;
			i++;
			for(j=1;j<=n;j+=2)
			{
				if(j==n){j--;}
				if(j==i)
				{
					if(j+2<=n){
						j++;
						cout<<"? "<<j<<" "<<j+1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+1){c=1;break;}
					}
					else
					{
						cout<<"? "<<n<<" "<<n-2<<"\n";
						cout.flush();
						cin>>w;
						if(w==n){c=1;break;}
						j++;
					}
				}
				else if(j+1==i)
				{
					if(i<n){
						cout<<"? "<<j<<" "<<j+2<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+2){c=1;break;}
						j++;
					}
					else
					{
						cout<<"? "<<j<<" "<<j-1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j){c=1; break;}
						j++;
					}
				}
				else
				{
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+1){c=1; break;}
				}
			}
			if(c)cout<<"! "<<w<<"\n";
			else cout<<"! "<<i<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}*/
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			if(w==v1[j]||w==v1[j+1])break;
			j++;
			i++;
			v1[j]=w;
		}
		if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,v,V,w,j=0,hash[n+1]={0},c1,c2,c3;
		vector<int>g[n];
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		queue<int>q;
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				//v[g[i][0]].pb(i);
				q.push(i+1);
				hash[i+1]++;
			}
		}
		i=0;
		while(i<=n/2&&!q.empty())
		{
			u=q.front();
			hash[u]--;
			q.pop();
			if(q.empty()){cout<<"! "<<u<<"\n"; cout.flush(); i--; break;}
			if(i==n/2){cout<<"-1\n"; break;}
			v=q.front();
			q.pop();
			hash[v]--;
			cout<<"? "<<u<<" "<<v<<"\n";
			cout.flush();
			cin>>w;
			c1=g[u-1].size();
			c2=g[v-1].size();
			c3=g[w-1].size();
			if(c1==c2&&c2==c3){cout<<"! "<<w<<"\n"; break;}
			if(!hash[w]){q.push(w); hash[w]++;}
			i++;
		}
		//if(i==n/2){cout<<"-1\n"; cout.flush();}
	}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		/*fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			int c=0;
			i++;
			for(j=1;j<=n;j+=2)
			{
				if(j==n){j--;}
				if(j==i)
				{
					if(j+2<=n){
						j++;
						cout<<"? "<<j<<" "<<j+1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+1){c=1;break;}
					}
					else
					{
						cout<<"? "<<n<<" "<<n-2<<"\n";
						cout.flush();
						cin>>w;
						if(w==n){c=1;break;}
						j++;
					}
				}
				else if(j+1==i)
				{
					if(i<n){
						cout<<"? "<<j<<" "<<j+2<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+2){c=1;break;}
						j++;
					}
					else
					{
						cout<<"? "<<j<<" "<<j-1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j){c=1; break;}
						j++;
					}
				}
				else
				{
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+1){c=1; break;}
				}
			}
			if(c)cout<<"! "<<w<<"\n";
			else cout<<"! "<<i<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}*/
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			int c=0;
			i++;
			for(j=1;j<=n;j+=2)
			{
				if(j==n){j--;}
				if(j==i)
				{
					if(j+2<=n){
						j++;
						cout<<"? "<<j<<" "<<j+1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+1){c=1;break;}
					}
					else
					{
						cout<<"? "<<n<<" "<<n-2<<"\n";
						cout.flush();
						cin>>w;
						if(w==n){c=1;break;}
						j++;
					}
				}
				else if(j+1==i)
				{
					if(i<n){
						cout<<"? "<<j<<" "<<j+2<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+2){c=1;break;}
						j++;
					}
					else
					{
						cout<<"? "<<j<<" "<<j-1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j){c=1; break;}
						j++;
					}
				}
				else
				{
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+1){c=1; break;}
				}
			}
			if(c)cout<<"! "<<w<<"\n";
			else cout<<"! "<<i<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			int c=0;
			i++;
			for(j=1;j<=n;j+=2)
			{
				if(j==n){cout<<"!\n";j--;}
				if(j==i)
				{
					if(j+2<=n){
						j++;
						cout<<"? "<<j<<" "<<j+1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+1){c=1;break;}
					}
					else
					{
						cout<<"? "<<n<<" "<<n-2<<"\n";
						cout.flush();
						cin>>w;
						if(w==n){c=1;break;}
						j++;
					}
				}
				else if(j+1==i)
				{
					if(i<n){
						cout<<"? "<<j<<" "<<j+2<<"\n";
						cout.flush();
						cin>>w;
						if(w==j||w==j+2){c=1;break;}
						j++;
					}
					else
					{
						cout<<"? "<<j<<" "<<j-1<<"\n";
						cout.flush();
						cin>>w;
						if(w==j){c=1; break;}
						j++;
					}
				}
				else
				{
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+1){c=1; break;}
				}
			}
			if(c)cout<<"! "<<w<<"\n";
			else cout<<"! "<<i<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			cout<<"! "<<i+1<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power((a*a),b/2));
	return ((a)*(power((a*a),b/2)));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
int edge[100010]={0};
bool cmp(int a,int b)
{
	return edge[a]>edge[b];
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.first>b.first;
}
//bool a[100003]100003];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		int n;
		cin>>n;
		int i,u,V,w,j=0;
		vector<int>g[n],v[n],v1;
		fr(i,n-1)
		{
			cin>>u>>V;
			u--;V--;
			g[u].pb(V);
			g[V].pb(u);
		}
		fr(i,n)
		{
			if(g[i].size()==1)
			{
				v[g[i][0]].pb(i);
			}
		}
		//fr(i,n)cout<<g[i].size()<<" ";cout<<"\n";
		fr(i,n){if(!v[i].empty())v1.pb(v[i][0]);}
		for(auto &x:v1)x++;
		//for(auto x:v1)cout<<x<<" ";cout<<"\n";
		i=0;
		while(i<n/2&&j<v1.size()-1)
		{
			cout<<"? "<<v1[j]<<" "<<v1[j+1]<<"\n";
			cout.flush();
			cin>>w;
			//if(w==v1[j]||w==v1[j+1]){j++; break;}
			j++;
			i++;
			v1[j]=w;
		}
		//cout<<w<<"\n";
		if(j==0)
		{
			//cout<<"!\n";
			for(i=0;i<n;i++)
			{
				int c=g[i].size();
				//cout<<c<<"\n";
				if(c>1)break;
			}
			int c=0;
			i++;
			for(j=1;j<=n;j+=2)
			{
				if(j==i)
				{
					j++;
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+1){c=1;break;}
				}
				else if(j+1==i)
				{
					cout<<"? "<<j<<" "<<j+2<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+2){c=1;break;}
					j++;
				}
				else
				{
					cout<<"? "<<j<<" "<<j+1<<"\n";
					cout.flush();
					cin>>w;
					if(w==j||w==j+2){c=1; break;}
				}
			}
			if(c)cout<<"! "<<w<<"\n";
			else cout<<"! "<<i<<"\n";
		}
		//cout<<w<<"\n";
		else if(i==n/2&&w!=v1[j]&&w!=v1[j+1])cout<<"-1\n";
		//cout<<w<<"\n";
		else cout<<"! "<<w<<"\n";
		cout.flush();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
bool v1[1000];
vector<int> res;
int lcp;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    srand(time(NULL));
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        /*for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                ans1=i;
            }
        }
        //visit[ans1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[ans1].size();i++)
        v1[t[ans1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }
        for (int j=1;j<=n && ans2==-1;j++)
        {
            if (!visit[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }*/
        res.clear();
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            res.push_back(i);
        }
        int len=res.size();
        int tt1=rand()%len;
        ans1=res[tt1];
        if (len==1)
        break;
        swap(res[tt1],res[len-1]);
        len--;
        ans2=res[rand()%len];
        c++;
        assert(c<=mi);
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
bool v1[1000];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        for (int i=1;i<=n && ans1=-1;i++)
        {
            if (!visit[i])
            {
                ans1=i;
            }
        }
        //visit[ans1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[ans1].size();i++)
        v1[t[ans1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }
        if (ans2==-1)
        {
            for (int j=1;j<=n ;j++)
            {
                if (ans2!=-1 && !visit[j])
                {
                    ans1=j;
                    break;
                }
                if (!visit[j] && j!=ans1)
                {
                    ans2=j;
                    break;
                }
            }
        }
        if (ans2==-1)
        break;
        c++;
        assert(c<=mi);
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
        ans1=lcp;
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    bool v1[1000];
    while (1)
    {
        t1=t2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                if (t1==-1)
                t1=i;
            }
        }
        visit[t1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[t1].size();i++)
        v1[t[t1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j])
            {
                t2=j;
                break;
            }
        }
        for (int j=1;j<=n && t2==-1;j++)
        {
            if (!visit[j])
            {
                t2=j;
                break;
            }
        }
        if (t2==-1)
        break;
        c++;
        assert(c<=mi);
        cout<<"? "<<t1<<" "<<t2<<endl;
        cout.flush();
        scanf("%d",&lcp);
        dfs(t1,t1);
        dfs(t2,t2);
    }
    cout<<"! "<<t1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
bool v1[1000];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                ans1=i;
            }
        }
        //visit[ans1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[ans1].size();i++)
        v1[t[ans1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }
        for (int j=1;j<=n && ans2==-1;j++)
        {
            if (!visit[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }
        if (ans2==-1)
        break;
        c++;
        assert(c<=mi);
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    bool v1[1000];
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                ans1=i;
            }
        }
        visit[ans1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[ans1].size();i++)
        v1[t[ans1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j])
            {
                ans2=j;
                break;
            }
        }
        for (int j=1;j<=n && ans2==-1;j++)
        {
            if (!visit[j])
            {
                ans2=j;
                break;
            }
        }
        if (ans2==-1)
        break;
        c++;
        assert(c<=mi);
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
bool v1[1000];
vector<int> res;
int lcp;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    srand(unsigned(time(NULL)));
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        /*for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                ans1=i;
            }
        }
        //visit[ans1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[ans1].size();i++)
        v1[t[ans1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }
        for (int j=1;j<=n && ans2==-1;j++)
        {
            if (!visit[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }*/
        res.clear();
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            res.push_back(i);
        }
        int len=res.size();
        int tt1=rand()%len;
        ans1=res[tt1];
        if (len==1)
        break;
        swap(res[tt1],res[len-1]);
        len--;
        ans2=res[rand()%len];
        c++;
        assert(c<=mi);
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
bool v1[1005];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                ans1=i;
            }
        }
        //visit[ans1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[ans1].size();i++)
        v1[t[ans1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }
        if (ans2==-1)
        {
            for (int j=1;j<=n ;j++)
            {
                if (ans2!=-1 && !visit[j])
                {
                    ans1=j;
                    break;
                }
                if (!visit[j] && j!=ans1)
                {
                    ans2=j;
                    break;
                }
            }
        }
        if (ans2==-1)
        break;
        c++;
        assert(c<=mi);
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
bool d[1005];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        memset(d,0,sizeof(d));
        for (int i=1;i<=n && ans2==-1;i++)
        {
            if (visit[i])
            continue;
            for (int j=0;j<t[i].size();j++)
            {
                if (!visit[t[i][j]])
                d[i]++;
            }
            if (d[i]==1)
            {
                if (ans1==-1)
                ans1=i;
                else
                ans2=i;
            }
        }
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int d[1005];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp || visit[u])
    return ;
    visit[u]=true;
    res--;
    for (int j=0;j<t[u].size();j++)
    d[t[u][j]]--;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        d[t1]++;
        d[t2]++;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    res=n;
    int c=0,mi=n/2;
    int ans1,ans2;
    while (res>1)
    {
        ans1=ans2=-1;
        for (int i=1;i<=n && ans2==-1;i++)
        {
            if (!visit[i] && d[i]==1)
            {
                if (ans1==-1)
                ans1=i;
                else
                ans2=i;
            }
        }
        /*
        cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        for (int i=1;i<=n;i++)
        cout<<d[i]<<" ";
        cout<<endl;*/
        if (ans2==-1)
        break;
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    for (int i=1;i<=n;i++)
    {
        if(!visit[i])
        {
            cout<<"! "<<i<<endl;
            break;
        }
    }
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int lcp;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    while (1)
    {
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        int t1=-1,t2=-1;
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                if (t1==-1)
                t1=i;
                else
                {
                    t2=i;
                    break;
                }
            }
        }
        if (t2==-1)
        break;
        c++;
        assert(c<=mi);
        cout<<"? "<<t1<<" "<<t2<<endl;
        cout.flush();
        scanf("%d",&lcp);
        dfs(t1,t1);
        dfs(t2,t2);
    }
    for (int i=1;i<=n;i++)
    if (!visit[i])
    {
        cout<<"! "<<i<<endl;
    }
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int d[1005];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp || visit[u])
    return ;
    visit[u]=true;
    res--;
    for (int j=0;j<t[u].size();j++)
    d[t[u][j]]--;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        d[t1]++;
        d[t2]++;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    res=n;
    int c=0,mi=n/2;
    int ans1,ans2;
    while (res>1)
    {
        ans1=ans2=-1;
        for (int i=1;i<=n && ans2==-1;i++)
        {
            if (!visit[i] && d[i]==1)
            {
                if (ans1==-1)
                ans1=i;
                else
                ans2=i;
            }
        }
        cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        for (int i=1;i<=n;i++)
        cout<<d[i]<<" ";
        cout<<endl;
        if (ans2==-1)
        break;
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    for (int i=1;i<=n;i++)
    {
        if(!visit[i])
        {
            cout<<"! "<<i<<endl;
            break;
        }
    }
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int d[1005];
int lca;
int res=0;
// dfs做子树的清除工作。
void dfs(int u,int f)
{
    //碰到lcp就直接返回 因为只是处理这棵子树，根节点不能处理
    if (u==lca)
    return ;
    visit[u]=true;
    res--;
    for (int j=0;j<t[u].size();j++)
    d[t[u][j]]--;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        d[t1]++;
        d[t2]++;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    res=n;
    int c=0,mi=n/2;
    int ans1,ans2;
    while (res>1)
    {
        ans1=ans2=-1;
        for (int i=1;i<=n && ans2==-1;i++)
        {
            if (!visit[i] && d[i]==1)
            {
                if (ans1==-1)
                ans1=i;
                else
                ans2=i;
            }
        }
        if (ans2==-1)
        break;
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lca;
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    for (int i=1;i<=n;i++)
    {
        if(!visit[i])
        {
            cout<<"! "<<i<<endl;
            break;
        }
    }
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int d[1005];
int lcp;
int res=0;
// dfs做子树的清除工作。
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    res--;
    for (int j=0;j<t[u].size();j++)
    d[t[u][j]]--;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        d[t1]++;
        d[t2]++;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    res=n;
    int c=0,mi=n/2;
    int ans1,ans2;
    while (res>1)
    {
        ans1=ans2=-1;
        for (int i=1;i<=n && ans2==-1;i++)
        {
            if (!visit[i] && d[i]==1)
            {
                if (ans1==-1)
                ans1=i;
                else
                ans2=i;
            }
        }
        if (ans2==-1)
        break;
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    for (int i=1;i<=n;i++)
    {
        if(!visit[i])
        {
            cout<<"! "<<i<<endl;
            break;
        }
    }
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
bool v1[1000];
int lcp;
int res=0;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    //assert(false);
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (1)
    {
        ans1=ans2=-1;
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                ans1=i;
            }
        }
        //visit[ans1]=true;
        memset(v1,0,sizeof(v1));
        for (int i=0;i<t[ans1].size();i++)
        v1[t[ans1][i]]=true;
        for (int j=1;j<=n;j++)
        {
            if (!visit[j] && !v1[j] && j!=ans1)
            {
                ans2=j;
                break;
            }
        }
        if (ans2==-1)
        {
            for (int j=1;j<=n ;j++)
            {
                if (ans2!=-1 && !visit[j])
                {
                    ans1=j;
                    break;
                }
                if (!visit[j] && j!=ans1)
                {
                    ans2=j;
                    break;
                }
            }
        }
        if (ans2==-1)
        break;
        c++;
        assert(c<=mi);
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lcp;
        //scanf("%d",&lcp);
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    cout<<"! "<<ans1<<endl;
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int lcp;
void dfs(int u,int f)
{
    if (u==lcp)
    return ;
    visit[u]=true;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int res=n;
    while (1)
    {
        /*cout<<"cas:";
        for (int i=1;i<=n;i++)
        cout<<visit[i]<<" ";
        cout<<endl;
        */
        int t1=-1,t2=-1;
        for (int i=1;i<=n;i++)
        {
            if (!visit[i])
            {
                if (t1==-1)
                t1=i;
                else
                {
                    t2=i;
                    break;
                }
            }
        }
        if (t2==-1)
        break;
        cout<<"? "<<t1<<" "<<t2<<endl;
        cout.flush();
        scanf("%d",&lcp);
        dfs(t1,t1);
        dfs(t2,t2);
    }
    for (int i=1;i<=n;i++)
    if (!visit[i])
    {
        cout<<"! "<<i<<endl;
    }
    cout.flush();
}


#include<bits/stdc++.h>
using namespace std;
vector<int> t[1005];
bool visit[1005];
int d[1005];
int lca;
// dfs做子树的清除工作。
void dfs(int u,int f)
{
    //碰到lcp就直接返回 因为只是处理这棵子树，根节点不能处理
    if (u==lca)
    return ;
    visit[u]=true;
    for (int j=0;j<t[u].size();j++)
    d[t[u][j]]--;
    for (int i=0;i<t[u].size();i++)
    {
        int to=t[u][i];
        if (to==f)
        continue;
        if (!visit[to])
        dfs(to,u);
    }
}
int main()
{
    int n,t1,t2;
    cin>>n;
    for (int i=1;i<n;i++)
    {
        cin>>t1>>t2;
        d[t1]++;
        d[t2]++;
        t[t1].push_back(t2);
        t[t2].push_back(t1);
    }
    int c=0,mi=n/2;
    int ans1,ans2;
    while (true)
    {
        ans1=ans2=-1;
        for (int i=1;i<=n && ans2==-1;i++)
        {
            if (!visit[i] && d[i]==1)
            {
                if (ans1==-1)
                ans1=i;
                else
                ans2=i;
            }
        }
        if (ans2==-1)
        break;
        cout<<"? "<<ans1<<" "<<ans2<<endl;
        cout.flush();
        cin>>lca;
        dfs(ans1,ans1);
        dfs(ans2,ans2);
    }
    for (int i=1;i<=n;i++)
    {
        if(!visit[i])
        {
            cout<<"! "<<i<<endl;
            break;
        }
    }
    cout.flush();
}


#include <bits/stdc++.h>
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef double d;

ll n,m,ch[1005];
vector<ll> g[1005];
queue<ll> q;

void dl(ll a)
{
	ch[g[a][0]]--;
	if(ch[g[a][0]]==1) q.push(g[a][0]);
}

int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		ll a,b;cin>>a>>b;
		g[a].push_back(b),g[b].push_back(a);
		ch[a]++,ch[b]++;
	}
	for(int i=1;i<=n;i++)
		if(ch[i]==1)
			q.push(i);
	while(q.size()>1)
	{
		ll a,b;
		a=q.front(),q.pop();
		b=q.front(),q.pop();
		cout<<"? "<<a<<" "<<b<<"\n";
		cout.flush();
		ll c;cin>>c;
		if(c==a)
		{
			cout<<"! "<<a;
			return 0;
		}
		if(c==b)
		{
			cout<<"! "<<b;
			return 0;
		}
		dl(a),dl(b);
	}
	cout<<"! "<<q.front();
	cout.flush();
	return 0;
}


#include <bits/stdc++.h>
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef double d;

ll n,m;
vector<ll> g[1005];
queue<ll> q;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	for(int i=1;i<n;i++)
	{
		ll a,b;cin>>a>>b;
		g[a].push_back(b),g[b].push_back(a);
	}
	for(int i=1;i<=n;i++)
		if(g[i].size()==1)
			q.push(i);
	while(q.size()>1)
	{
		ll a,b;
		a=q.front(),q.pop();
		b=q.front(),q.pop();
		cout<<"? "<<a<<" "<<b;
		fflush(stdout);
		cin>>a,q.push(a);
	}
	cout<<"! "<<q.front();
	fflush(stdout);
	return 0;
}


#include <bits/stdc++.h>
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef double d;

ll n,m;
vector<ll> g[1005];
queue<ll> q;

int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		ll a,b;cin>>a>>b;
		g[a].push_back(b),g[b].push_back(a);
	}
	for(int i=1;i<=n;i++)
		if(g[i].size()==1)
			q.push(i);
	while(q.size()>1)
	{
		ll a,b;
		a=q.front(),q.pop();
		b=q.front(),q.pop();
		cout<<"? "<<a<<" "<<b<<"\n";
		cout.flush();
		cin>>a,q.push(a);
	}
	cout<<"! "<<q.front();
	cout.flush();
	return 0;
}


/*
	Codeforces: 446C. DZY Loves Fibonacci Numbers
*/
#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b, __ = c; a < __; ++a)
#define dbg(x) cerr << ">>>> " << x << endl;
#define _ << " , " <<

using namespace std;
typedef int ll;

const ll mod = ll(1e9) + 9;
const int Q = 550, ms = Q*Q;

ll fib[ms], sum_fib[ms], sum_buck[Q], a[ms], la[Q][2];
void lazy(int bk){
	if(la[bk][0] + la[bk][1] == 0LL)
		return;
	ll va = la[bk][0], vb = la[bk][1];
	fr(i, bk*Q, (bk+1)*Q){
		a[i] = (a[i] + va)%mod;
		ll c = (va + vb)%mod;
		va = vb;
		vb = c;
	}
	la[bk][0] = la[bk][1] = 0;
}

inline ll val(int i){
	int b = i/Q, p = i - b*Q;
	if(p < 2){
		return (la[b][p] + a[i])%mod;
	}
	--p;
	return (( ( (long long)la[b][0] ) *fib[p]) + (( (long long) la[b][1])*fib[p+1]) + a[i])%mod;
}

int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	fib[1] = 1;
	sum_fib[1] = 1;
	fr(i, 2, n+2){
		fib[i] = (fib[i-1] + fib[i-2])%mod;
		sum_fib[i] = (sum_fib[i-1] + fib[i])%mod;
	}

	fr(i, 0, n){
		scanf("%d", a+i);
		sum_buck[i/Q] = (sum_buck[i/Q] + a[i])%mod;
	}

	fr(dasda, 0, m){
		int t, l, r;
		scanf("%d %d %d", &t, &l, &r);
		--l, --r;
		int bl = l/Q, br = r/Q;
		if(2 == t){
			ll ans = 0;
			fr(i, bl+1, br)
				ans = (ans + sum_buck[i])%mod;

			for(int i = l; i/Q == bl && i <= r; ++i)
				ans = (ans + val(i))%mod;
			if(bl != br){
				for(int i = br*Q; i <= r; ++i)
					ans = (ans + val(i))%mod;
			}
			printf("%d\n", ans);
		}
		else{
			for(int i = l; i/Q == bl && i <= r; ++i){
				a[i] = (fib[i-l+1] + a[i])%mod;
				sum_buck[bl] = (sum_buck[bl] + fib[i-l+1])%mod;
			}
			if(bl != br){
				for(int i = br*Q; i <= r; ++i){
					a[i] = (fib[i-l+1] + a[i])%mod;
					sum_buck[br] = (sum_buck[br] + fib[i-l+1])%mod;
				}
			}
			fr(i, bl+1, br){
				la[i][0] = (la[i][0] + fib[i*Q-l+1])%mod;
				la[i][1] = (la[i][1] + fib[i*Q-l+2])%mod;
				sum_buck[i] = (((sum_buck[i] + sum_fib[(i+1)*Q - l])%mod - sum_fib[i*Q - l ]) %mod + mod)%mod;
			}
		}
	}
	return 0;
}


/*
	Codeforces: 446C. DZY Loves Fibonacci Numbers
*/
#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b, __ = c; a < __; ++a)
#define dbg(x) cerr << ">>> "  << x << endl;
#define _ << " , " <<

using namespace std;
typedef pair<int, int> ii;
typedef long long ll;

const ll mod = ll(1e9) + 9;
const int Q = 550, ms = Q*Q, mv = 2*Q;
int n, m;

ll a[ms], buck_sum[ms], fib[ms], fib_sum[ms];
ii q[mv];

void rebuild(){
	sort(q, q + mv);
	int p = 0;
	ll f1 = 0, f2 = 0;
	fr(i, 0, n){
		while(p < mv && q[i].first == i){
			if(q[i].second == -1){
				++f1;
				f1%=mod;
			}
			else{
				int r = q[i].first, l = q[i].second;
				f1 = (f1 - fib[r - l + 1] + mod)%mod;
				f2 = (f2 - fib[r - l] + mod)%mod;
			}
			++p;
		}
		a[i] = (a[i] + f1)%mod;
		buck_sum[i/Q] = (buck_sum[i/Q] + f2)%mod;
		ll n = (f1 + f2)%mod;
		f2 = f1;
		f1 = n;
 	}
}

int main(){
	ios::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	fib[1] = 1;
	fib_sum[1] = 1;
	fr(i, 2, n+2){
		fib[i] = (fib[i-1] + fib[i-2])%mod;
		fib_sum[i] = (fib_sum[i-1] + fib[i])%mod;
	}

	fr(i, 0, n){
		cin >> a[i];
		buck_sum[i/Q] = (buck_sum[i/Q] + a[i])%mod;
	}
	int cnt = 0;
	fr(dasda, 0, m){
		int t, l, r;
		cin >> t >> l >> r;
		--l, --r;
		int bl = l/Q, br = r/Q;
		if(2 == t){
			ll ans = 0;
			fr(i, bl+1, br)
				ans = (ans + buck_sum[i])%mod;

			for(int i = l; i/Q == bl && i <= r; ++i)
				ans = (ans + a[i])%mod;
			if(bl != br){
				for(int i = br*Q; i <= r; ++i)
					ans = (ans + a[i])%mod;
			}
			fr(i, 1, cnt){
				int s = max(l, q[i].second), e = min(r, q[i].first-1);
				if(e < s){
					++i;
					continue;
				}
				ans = (ans + fib_sum[e - q[i].second + 1])%mod;
				ans = (ans - fib_sum[s - q[i].second] + mod)%mod;
				++i;
			}
			cout << ans << endl;
		}
		else{
			q[cnt++] = ii(l, -1);
			q[cnt++] = ii(r+1, l);
		}
		if(cnt == mv){
			rebuild();
			cnt = 0;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define rfre(a, b) for(int a = radj[b]; a != -1; a = rant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define sc(a) scanf("%lld", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf(" %s", s)
#define pri(x) printf("%d\n", x)
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define dbg(x) if(1) cerr << ">>>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf  = 0x3f3f3f3f;
const int minf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::vector<vi > vii;
typedef std::pair<int, int> ii;
typedef std::pair<ii, ii> iii;
typedef std::pair<ll, ll> pll;

const int ma = 311111, Q = 500;
const ll mod = 1e9 + 9;
ll v[ma], fib[ma], sum[ma], buck[Q], soma[Q][2];
int n, m;

int main(){
	fib[0] = 0;
	fib[1] = 1;
	fib[2] = 1;
	fr(i, 3, ma) fib[i] = (fib[i-1] + fib[i-2])%mod;
	fr(i, 1, ma) sum[i] = fib[i];
	fr(i, 1, ma) sum[i] = (sum[i] + sum[i-1])%mod;

	sc2(n, m);
	rp(i, n) sc(v[i+1]);
	rp(i, n){
		buck[(i+1)/Q] = (buck[(i+1)/Q] +  v[i])%mod;
	}
	rp(oooi, m){
		int t, l, r;
		sc3(t, l, r);
		if(t == 1){
			int bl = l/Q, br = r/Q;
			fr(i, bl+1, br){
				buck[i] = ((buck[i] + sum[(i+1)*Q - l] - sum[i*Q - l])%mod + mod)%mod;
				soma[i][0] = (soma[i][0] + fib[i*Q - l + 1])%mod;
				soma[i][1] = (soma[i][1] + fib[i*Q - l + 2])%mod;
			}
			// dbg(l _ min((bl+1)*Q, r+1))
			fr(i, l, min((bl+1)*Q, r+1)){
				buck[bl] = (buck[bl] + fib[i-l+1])%mod;
				// dbg(v[i] _ fib[i-l+1] _ i-l+1)
				v[i] = (v[i] + fib[i-l+1])%mod;
				// dbg(v[i])
			}
			if(bl != br){
				fr(i, br*Q, r+1){
					buck[br] = (buck[br] + fib[i-l+1])%mod;
					v[i] = (v[i] + fib[i-l+1])%mod;
				}
			}
			rp(i, n) dbg(v[i+1])
		}
		else{
			int bl = l/Q, br = r/Q;
			ll ans = 0;
			dbg(bl _ br);
			fr(i, bl+1, br){
				ans = (ans + buck[i])%mod;
			}
			fr(i, l, min((bl+1)*Q, r+1)){
				ans = ((ans + (fib[i - bl*Q + 1] * soma[bl][0])%mod)%mod + (fib[i - bl*Q]*soma[bl][1])%mod + v[i])%mod;
			}
			if(bl != br){
				fr(i, br*Q, r+1){
					ans = ((ans + (fib[i - br*Q + 1] * soma[br][0])%mod)%mod + (fib[i - br*Q]*soma[br][1])%mod)%mod;
				}
			}
			printf("%lld\n", ans);
		}
	}
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define rfre(a, b) for(int a = radj[b]; a != -1; a = rant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define sc(a) scanf("%lld", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf(" %s", s)
#define pri(x) printf("%d\n", x)
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define dbg(x) if(1) cerr << ">>>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf  = 0x3f3f3f3f;
const int minf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::vector<vi > vii;
typedef std::pair<int, int> ii;
typedef std::pair<ii, ii> iii;
typedef std::pair<ll, ll> pll;

const int ma = 311111, Q = 600;
const ll mod = 1e9 + 9;
ll v[ma], fib[ma], sum[ma], buck[Q+10], soma[Q+10][2];
int n, m;

int main(){
	fib[0] = 0;
	fib[1] = 1;
	fib[2] = 1;
	fr(i, 3, ma) fib[i] = (fib[i-1] + fib[i-2])%mod;
	fr(i, 1, ma) sum[i] = (fib[i] + sum[i-1])%mod;
	sc2(n, m);
	fr(i, 1, n+1){
		sc(v[i]);
		int bk = i/Q;
		buck[bk] = (buck[bk] +  v[i])%mod;
	}
	rp(oooi, m){
		int t, l, r;
		sc3(t, l, r);
		if(t == 1){
			int bl = l/Q, br = r/Q;
			int s = (bl+1)*Q, e = br*Q;
			for(int i = s, bk = bl+1; bk < br; i += Q, ++bk){
				buck[bk] = ((buck[bk] + sum[i+Q - l] - sum[i - l])%mod + mod)%mod;
				soma[bk][0] = (soma[bk][0] + fib[i - l + 1])%mod;
				soma[bk][1] = (soma[bk][1] + fib[i - l + 2])%mod;
			}

			int hehe = min(s, r+1);
			fr(i, l, hehe){
				buck[bl] = (buck[bl] + fib[i-l+1])%mod;
				v[i] = (v[i] + fib[i-l+1])%mod;
			}

			if(bl != br){
				fr(i, e, r+1){
					buck[br] = (buck[br] + fib[i-l+1])%mod;
					v[i] = (v[i] + fib[i-l+1])%mod;
				}
			}
		}
		else{
			int bl = l/Q, br = r/Q;
			ll ans = 0;
			fr(i, bl+1, br){
				ans = (ans + buck[i])%mod;
			}
			int s = bl*Q, oir = min(s+Q, r+1);
			if(l == s) ans = (ans + soma[bl][0])%mod;
			if(l == s+1) ans = (ans + soma[bl][1])%mod;
			ll s1 = 0, s2 = 0;
			// dbg(l _ oir _ bl _ br)
			dbg(l - s)
			s1 = ((sum[oir - s - 2] - sum[max(l - s - 2, 0)])%mod + mod)%mod;
			s2 = ((sum[oir - s - 1] - sum[max(l - s - 1, 1)])%mod + mod)%mod;
			dbg(s1 _ s2)

			fr(i, l, oir){
				ans = (ans + v[i])%mod;
			}
			ans = (ans + (s1 * soma[bl][0])%mod)%mod;
			ans = (ans + (s2 * soma[bl][1])%mod)%mod;

			if(bl != br){
				fr(i, br*Q, r+1){
					ans = (ans + v[i])%mod;
					if(i - br*Q == 0){
						ans = (ans + soma[br][0])%mod;
					}
					else if(i - br*Q == 1){
						ans = (ans + soma[br][1])%mod;
					}
					else{
						ans = (ans + (soma[br][0]*fib[i - br*Q - 1])%mod)%mod;
						ans = (ans + (soma[br][1]*fib[i - br*Q    ])%mod)%mod;
					}
				}
			}
			printf("%lld\n", ans);
		}
	}
}


/*
	Codeforces: 446C. DZY Loves Fibonacci Numbers
*/
#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b, __ = c; a < __; ++a)
#define dbg(x) cerr << ">>> "  << x << endl;
#define _ << " , " <<

using namespace std;
typedef pair<int, int> ii;
typedef long long ll;

const ll mod = ll(1e9) + 9;
const int Q = 550, ms = Q*Q, mv = 2*Q;
int n, m;

ll a[ms], buck_sum[ms], fib[ms], fib_sum[ms];
ii q[mv];

void rebuild(){
	sort(q, q + 2*Q);
	int p = 0;
	ll f1 = 0, f2 = 0;
	fr(i, 0, n){
		while(p < mv && q[i].first == i){
			if(q[i].second == -1){
				++f1;
				f1%=mod;
			}
			else{
				int r = q[i].first, l = q[i].second;
				f1 = (f1 - fib[r - l + 1] + mod)%mod;
				f2 = (f2 - fib[r - l] + mod)%mod;
			}
		}
		a[i] = (a[i] + f1)%mod;
		buck_sum[i/Q] = (buck_sum[i/Q] + f2)%mod;
		ll n = (f1 + f2)%mod;
		f2 = f1;
		f1 = n;
 	}
}

int main(){
	ios::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	fib[1] = 1;
	fib_sum[1] = 1;
	fr(i, 2, n+2){
		fib[i] = (fib[i-1] + fib[i-2])%mod;
		fib_sum[i] = (fib_sum[i-1] + fib[i])%mod;
	}

	fr(i, 0, n){
		cin >> a[i];
		buck_sum[i/Q] = (buck_sum[i/Q] + a[i])%mod;
	}
	int cnt = 0;
	fr(dasda, 0, m){
		int t, l, r;
		cin >> t >> l >> r;
		--l, --r;
		int bl = l/Q, br = r/Q;
		if(2 == t){
			ll ans = 0;
			fr(i, bl+1, br)
				ans = (ans + buck_sum[i])%mod;

			for(int i = l; i/Q == bl && i <= r; ++i)
				ans = (ans + a[i])%mod;
			if(bl != br){
				for(int i = br*Q; i <= r; ++i)
					ans = (ans + a[i])%mod;
			}
			fr(i, 1, cnt){
				int s = max(l, q[i].second), e = min(r, q[i].first-1);
				if(e < s)
					continue;
				ans = (ans + fib_sum[e - q[i].second + 1])%mod;
				ans = (ans - fib_sum[s - q[i].second] + mod)%mod;
				++i;
			}
			cout << ans << endl;
		}
		else{
			q[cnt++] = ii(l, -1);
			q[cnt++] = ii(r+1, l);
		}
		if(cnt == mv){
			rebuild();
			cnt = 0;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define rfre(a, b) for(int a = radj[b]; a != -1; a = rant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define sc(a) scanf("%lld", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf(" %s", s)
#define pri(x) printf("%d\n", x)
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define dbg(x) if(1) cerr << ">>>> " << x << endl;
#define _ << " , " <<

using namespace std;
const int inf  = 0x3f3f3f3f;
const int minf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::vector<vi > vii;
typedef std::pair<int, int> ii;
typedef std::pair<ii, ii> iii;
typedef std::pair<ll, ll> pll;

const int ma = 311111, Q = 600;
const ll mod = 1e9 + 9;
ll v[ma], fib[ma], sum[ma], buck[Q], soma[Q][2];
int n, m;

int main(){
	fib[0] = 0;
	fib[1] = 1;
	fib[2] = 1;
	fr(i, 3, ma) fib[i] = (fib[i-1] + fib[i-2])%mod;
	fr(i, 1, ma) sum[i] = fib[i];
	fr(i, 1, ma) sum[i] = (sum[i] + sum[i-1])%mod;
	return 0;
	sc2(n, m);
	rp(i, n) sc(v[i+1]);
	rp(i, n){
		buck[(i+1)/Q] = (buck[(i+1)/Q] +  v[i])%mod;
	}
	rp(oooi, m){
		int t, l, r;
		sc3(t, l, r);
		if(t == 1){
			int bl = l/Q, br = r/Q;
			fr(i, bl+1, br){
				buck[i] = ((buck[i] + sum[(i+1)*Q - l] - sum[i*Q - l])%mod + mod)%mod;
				soma[i][0] = (soma[i][0] + fib[i*Q - l + 1])%mod;
				soma[i][1] = (soma[i][1] + fib[i*Q - l + 2])%mod;
			}
			// dbg(l _ min((bl+1)*Q, r+1))
			fr(i, l, min((bl+1)*Q, r+1)){
				buck[bl] = (buck[bl] + fib[i-l+1])%mod;
				// dbg(v[i] _ fib[i-l+1] _ i-l+1)
				v[i] = (v[i] + fib[i-l+1])%mod;
				// dbg(v[i])
			}
			if(bl != br){
				fr(i, br*Q, r+1){
					buck[br] = (buck[br] + fib[i-l+1])%mod;
					v[i] = (v[i] + fib[i-l+1])%mod;
				}
			}
			rp(i, n) dbg(v[i+1])
		}
		else{
			int bl = l/Q, br = r/Q;
			ll ans = 0;
			dbg(bl _ br);
			fr(i, bl+1, br){
				ans = (ans + buck[i])%mod;
			}
			fr(i, l, min((bl+1)*Q, r+1)){
				ans = ((ans + (fib[i - bl*Q + 1] * soma[bl][0])%mod)%mod + (fib[i - bl*Q]*soma[bl][1])%mod + v[i])%mod;
			}
			if(bl != br){
				fr(i, br*Q, r+1){
					ans = ((ans + (fib[i - br*Q + 1] * soma[br][0])%mod)%mod + (fib[i - br*Q]*soma[br][1])%mod)%mod;
				}
			}
			printf("%lld\n", ans);
		}
	}
}


#include<bits/stdc++.h>
#define mod 1000000009
#define five 383008016
#define inv5 276601605
#define five1 691504013
#define five2 308495997
using namespace std;
int n,m;
long long a[300005];
int op,L,R;

int sqrtn;
int bl[300005];//block
int l[10005],r[10005],tt;
int siz[10005];//size
long long lazy1[10005],lazy2[10005];
long long sum[10005];

long long mi(long long n,long long p)
{
    if(n==0) return 0;
    if(p==0) return 1;
    long long yuan=1,mul=n;
    while(p)
    {
        if(p&1) yuan*=mul;
        yuan%=mod;
        mul*=mul;
        mul%=mod;
        p>>=1;
    }
    return yuan%mod;
}

long long f[300005];
long long fs[300005];
long long m1[300005],m2[300005];
inline void init()
{
    f[1]=f[2]=1;
    for(int i=3;i<=300000;i++) f[i]=(f[i-1]+f[i-2])%mod;
    for(int i=1;i<=300000;i++) fs[i]=(fs[i-1]+f[i])%mod;
    m1[0]=m2[0]=1;
    for(int i=1;i<=n;i++)
    {
        m1[i]=m1[i-1]*(five+1)%mod*mi(2,mod-2)%mod;
        m2[i]=m2[i-1]*(1-five+mod)%mod*mi(2,mod-2)%mod;
    }
}

inline void inblock()
{
    for(int i=1;i<=n/sqrtn;i++)
    {
        tt++;
        l[tt]=r[tt-1]+1;
        r[tt]=r[tt-1]+sqrtn;
        siz[tt]=r[tt]-l[tt]+1;
        for(int j=l[tt];j<=r[tt];j++) bl[j]=tt;
    }
    if(sqrtn*sqrtn!=n)
    {
        tt++;l[tt]=r[tt-1]+1;r[tt]=n;siz[tt]=r[tt]-l[tt]+1;
        for(int j=l[tt];j<=r[tt];j++) bl[j]=tt;
    }
}

inline void push_down()
{
    if(lazy1[bl[L]]!=0 || lazy2[bl[L]]!=0)
    {
        int tot=0;
        for(int i=l[bl[L]];i<=r[bl[L]];i++)
        {
            a[i]+=lazy1[bl[L]]*m1[tot]%mod*inv5%mod;
            a[i]-=lazy2[bl[L]]*m2[tot]%mod*inv5%mod;
            a[i]%=mod;
            tot++;
        }
        lazy1[bl[L]]=lazy2[bl[L]]=0;
    }
    if(lazy1[bl[R]]!=0 || lazy2[bl[R]]!=0)
    {
        int tot=0;
        for(int i=l[bl[R]];i<=r[bl[R]];i++)
        {
            a[i]+=lazy1[bl[R]]*m1[tot]%mod*inv5%mod;
            a[i]-=lazy2[bl[R]]*m2[tot]%mod*inv5%mod;
            a[i]%=mod;
            tot++;
        }
        lazy1[bl[R]]=lazy2[bl[R]]=0;
    }
//  cout<<"pushed:"<<endl;
//  for(int i=1;i<=n;i++) cout<<a[i]<<" "; cout<<endl;
}

inline void insert()
{
    push_down();
    if(bl[L]==bl[R])
    {
        int tot=1;
        for(int i=L;i<=R;i++)
        {
            a[i]+=f[tot]%mod; a[i]%=mod;
            tot++;
        }
        sum[bl[L]]+=fs[tot-1]%mod; sum[bl[L]]%=mod;
        return ;
    }

    int tot=1;
    for(int i=L;i<=r[bl[L]];i++)
    {
        a[i]+=f[tot]%mod; a[i]%=mod;
        sum[bl[L]]+=f[tot]%mod; sum[bl[L]]%=mod;
        tot++;
    }
    for(int i=bl[L]+1;i<bl[R];i++)
    {
        lazy1[i]+=m1[tot]%mod; lazy1[i]%=mod;
        lazy2[i]+=m2[tot]%mod; lazy2[i]%=mod;
        sum[i]+=fs[tot+siz[i]-1]-fs[tot-1]; sum[i]%=mod;
        tot+=siz[i];
    }
    for(int i=l[bl[R]];i<=R;i++)
    {
        a[i]+=f[tot]%mod; a[i]%=mod;
        sum[bl[R]]+=f[tot]%mod; sum[bl[R]]%=mod;
        tot++;
    }
}

inline void ask()
{
    long long anss=0;
    push_down();

    if(bl[L]==bl[R])
    {
        for(int i=L;i<=R;i++)
        {
            anss+=a[i]%mod;
            anss%=mod;
        }
        cout<<(anss%mod+mod)%mod<<endl;
        return ;
    }

    for(int i=L;i<=r[bl[L]];i++)
    {
        anss+=a[i]%mod;
        anss%=mod;
    }
    for(int i=l[bl[R]];i<=R;i++)
    {
        anss+=a[i]%mod;
        anss%=mod;
    }
    for(int i=bl[L]+1;i<bl[R];i++)
    {
        anss+=sum[i]%mod;
        anss%=mod;
    }
    cout<<(anss%mod+mod)%mod<<endl;
    return ;
}

int main()
{
//  freopen("rd.in","r",stdin);
//  freopen("my.out","w",stdout);
    ios::sync_with_stdio(0);
    cin>>n>>m;
    sqrtn=pow(n,0.3);
    inblock();
    init();
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum[bl[i]]+=a[i];
        sum[bl[i]]%=mod;
    }

//  for(int i=1;i<=n;i++) cout<<bl[i]<<" "; cout<<endl;
//  for(int i=1;i<=tt;i++) cout<<sum[i]<<" "; cout<<endl;
//  cout<<endl;
    while(m--)
    {
        cin>>op>>L>>R;
        if(op==1)
        {
            insert();
//          cout<<endl;
//          for(int i=1;i<=n;i++) cout<<a[i]<<" "; cout<<endl;
//          for(int i=1;i<=tt;i++) cout<<sum[i]<<" "; cout<<endl;
//          cout<<endl;
        }
        else
        {
            ask();
        }
    }
}


#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define ls p<<1
#define rs p<<1|1
using namespace std;
typedef long long ll;
const ll mxn=1e6+5,mod=1e9+9;
ll n,m,cnt,a[mxn],hd[mxn];
ll f[mxn],tr[mxn<<2],vis[mxn<<2],tag[mxn<<2][2];

inline ll read() {
	char c=getchar(); ll x=0,f=1;
	while(c>'9'||c<'0') {if(c=='-') f=-1;c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<3)+(x<<1)+(c&15);c=getchar();}
	return x*f;
}
inline void chkmax(ll &x,ll y) {if(x<y) x=y;}
inline void chkmin(ll &x,ll y) {if(x>y) x=y;}

struct ed {
	ll to,nxt;
}t[mxn<<1];

inline void add(ll u,ll v) {
	t[++cnt]=(ed) {v,hd[u]}; hd[u]=cnt;
}

void push_up(ll p) {
	tr[p]=(tr[ls]+tr[rs])%mod;
}

struct ST {
	ll x,y;
};

ST fibget(ST tp,ll len) {
	ll c=tp.x*f[len]%mod+tp.y*f[len+1]%mod,d=tp.x*f[len+1]%mod+tp.y*f[len+2]%mod;
	return (ST) {c%mod,d%mod};
}

ll fibcal(ll f1,ll f2,ll len) {
	ll res=0;
	if(len>=1) res=f1;
	if(len>=2) res=(res+f2)%mod;
	if(len>=3) res=(res+f2*(f[len+1]-2)%mod+f1*(f[len]-1)%mod+mod)%mod;
	//前两项的系数的值,直接乘以当前f[i+1],f[i],计算出f[i+2]
	return res;
}

void push_down(ll p,ll l,ll r) {
	ll mid=(l+r)>>1;
	if(vis[p]) {
		ll &a=tag[p][0],&b=tag[p][1];
		tag[ls][0]=(tag[ls][0]+a)%mod;
		tag[ls][1]=(tag[ls][1]+b)%mod;
		tr[ls]=(tr[ls]+fibcal(a,b,mid-l+1))%mod;
		vis[ls]=1;

		ll c=a*f[mid-l]+b*f[mid-l+1],d=a*f[mid-l+1]+b*f[mid-l+2];
		c%=mod; d%=mod;
		tag[rs][0]=(tag[rs][0]+c)%mod;
		tag[rs][1]=(tag[rs][1]+d)%mod;
		tr[rs]=(tr[rs]+fibcal(c,d,r-mid))%mod;
		vis[rs]=1;

		vis[p]=tag[p][0]=tag[p][1]=0;
	}
}

void build(ll l,ll r,ll p) {
	if(l==r) {tr[p]=a[l]; return ;}
	ll mid=(l+r)>>1;
	build(l,mid,ls); build(mid+1,r,rs); push_up(p);
}

void modify(ll l,ll r,ll ql,ll qr,ll val1,ll val2,ll p) {
	if(ql<=l&&r<=qr) {
		tag[p][0]=(tag[p][0]+val1)%mod;
		tag[p][1]=(tag[p][1]+val2)%mod;
		tr[p]=(tr[p]+fibcal(val1,val2,r-l+1))%mod;
		vis[p]=1; return ;
	}
	ll mid=(l+r)>>1; push_down(p,l,r);
	if(qr<=mid) modify(l,mid,ql,qr,val1,val2,ls);
	else if(ql>mid) modify(mid+1,r,ql,qr,val1,val2,rs);
	else {
		modify(l,mid,ql,qr,val1,val2,ls);
		ST z=fibget((ST){val1,val2},mid-ql);
		modify(mid+1,r,mid,qr,z.x,z.y,rs); //算出区间前两个fib,貌似也可以用前缀和
	}
	push_up(p);
}

ll query(ll l,ll r,ll ql,ll qr,ll p) {
	if(ql<=l&&r<=qr) return tr[p];
	ll mid=(l+r)>>1; push_down(p,l,r); ll res=0;
	if(ql<=mid) res=(res+query(l,mid,ql,qr,ls))%mod;
	if(qr>mid) res=(res+query(mid+1,r,ql,qr,rs))%mod;
	return res;
}

void init() {
	n=read(); m=read(); ll x,y,opt; f[1]=f[2]=1;
	for(ll i=3;i<=n+4;++i) f[i]=(f[i-1]+f[i-2])%mod;
	for(ll i=1;i<=n;++i) a[i]=read()%mod; build(1,n,1);
	for(ll i=1;i<=m;++i) {
		opt=read(); x=read(); y=read();
		if(opt==1) modify(1,n,x,y,1,1,1);
		else printf("%lld\n",(query(1,n,x,y,1)+mod)%mod);
	}
}

int main()
{
	init();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=3e5+5,mod=1e9+9;
int n,m,a[N],s[N],f[N],ss[N],g[N],sum[N<<2],add1[N<<2],add2[N<<2],k,l,r,s1,s2;
void pushup(int rt)
{
	sum[rt]=(sum[rt<<1]+sum[rt<<1|1]);
}
void pushdown(int rt,int l,int r)
{
	int m=l+r>>1;
	if(add1[rt])
	{
		sum[rt<<1]=(sum[rt<<1]+1ll*(ss[m+1]-ss[l]+mod)%mod*add1[rt])%mod;
		sum[rt<<1|1]=(sum[rt<<1|1]+1ll*(ss[r+1]-ss[m+1]+mod)%mod*add1[rt])%mod;
		add1[rt<<1]=(add1[rt<<1]+add1[rt])%mod;
		add1[rt<<1|1]=(add1[rt<<1|1]+add1[rt])%mod;
		add1[rt]=0;
	}
	if(add2[rt])
	{
		sum[rt<<1]=(sum[rt<<1]+1ll*(ss[m]-ss[l-1]+mod)%mod*add2[rt])%mod;
		sum[rt<<1|1]=(sum[rt<<1|1]+1ll*(ss[r]-ss[m]+mod)%mod*add2[rt])%mod;
		add2[rt<<1]=(add2[rt<<1]+add2[rt])%mod;
		add2[rt<<1|1]=(add2[rt<<1|1]+add2[rt])%mod;
		add2[rt]=0;
	}
}
void update(int rt,int l,int r,int L,int R)
{
	if(L<=l && r<=R)
	{
		sum[rt]=(sum[rt]+1ll*(ss[r+1]-ss[l]+mod)%mod*s1)%mod;
		sum[rt]=(sum[rt]+1ll*(ss[r]-ss[l-1]+mod)%mod*s2)%mod;
		add1[rt]=(add1[rt]+s1)%mod;
		add2[rt]=(add2[rt]+s2)%mod;
		return;
	}
	pushdown(rt,l,r);
	int m=l+r>>1;
	if(L<=m)update(rt<<1,l,m,L,R);
	if(R>m)update(rt<<1|1,m+1,r,L,R);
	pushup(rt);
}
int query(int rt,int l,int r,int L,int R)
{
	if(L<=l && r<=R)return sum[rt];
	pushdown(rt,l,r);
	int m=l+r>>1,ans=0;
	if(L<=m)ans=(ans+query(rt<<1,l,m,L,R))%mod;
	if(R>m)ans=(ans+query(rt<<1|1,m+1,r,L,R))%mod;
	return ans;
}
signed main()
{
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]),s[i]=(s[i-1]+a[i])%mod;
	f[1]=f[2]=1;
	for(int i=3;i<=n+1;i++)
		f[i]=(f[i-1]+f[i-2])%mod;
	for(int i=1;i<=n+1;i++)ss[i]=(ss[i-1]+f[i])%mod;
	g[1]=(f[1]-f[0]+mod)%mod,g[2]=(f[0]-g[1]+mod)%mod;
	for(int i=3;i<=n+1;i++)
		g[i]=i&1?f[i]:mod-f[i];
	while(m--)
	{
		scanf("%lld%lld%lld",&k,&l,&r);
		if(k==1)s1=g[l-1],s2=g[l],update(1,1,n,l,r);
		else printf("%lld\n",(query(1,1,n,l,r)+(s[r]-s[l-1]+mod)%mod)%mod);
	}
}