#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=50010;
int n,x,start;
bool vis[N];

PII ask(int a) {
    printf("? %d\n",a);
    fflush(stdout);
    int tmp=0;
    int nxt=0;
    scanf("%d%d",&tmp,&nxt);
    return {tmp,nxt};
}

int main()
{
    scanf("%d%d%d",&n,&start,&x);
    PII s=ask(start);
    vis[start]=1;
    if (s.first>=x) {
        printf("! %d\n",s.first);
        fflush(stdout);
        return 0;
    }
    vector<PII> vec;
    vec.pb(s);
    for (int i=1;i<min(n,1000);i++) {
        while (true) {
            int idx=(rand()%n)+1;
            if (!vis[idx]) {
                PII tmp=ask(idx);
                vec.pb(tmp);
                vis[idx]=true;
                break;
            }
        }
    }
    sort(vec.begin(),vec.end());
    int idx=0;
    while (idx<vec.size()&&vec[idx].first<x) idx++;
    int target=0;
    if (idx==vec.size()) {
        target=vec.back().second;
    } else {
        if (vec[idx].first==x) {
            printf("! %d\n",x);
            fflush(stdout);
            return 0;
        } else if (idx==0) {
            target=start;
        } else {
            target=vec[idx-1].second;
        }
    }

    int val=0;
    int nxt=0;
    printf("? %d\n",target);
    fflush(stdout);
    scanf("%d%d",&val,&nxt);
    while (val<x&&nxt!=-1) {
        printf("? %d\n",nxt);
        fflush(stdout);
        scanf("%d%d",&val,&nxt);
    }

    printf("! %d\n",val);
    fflush(stdout);
}


#include <ctime>

#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=50010;
int n,x,start;
bool vis[N];

PII ask(int a) {
    printf("? %d\n",a);
    fflush(stdout);
    int tmp=0;
    int nxt=0;
    scanf("%d%d",&tmp,&nxt);
    return {tmp,nxt};
}

int main()
{
    srand(time(0)+INF);
    scanf("%d%d%d",&n,&start,&x);
    PII s=ask(start);
    vis[start]=1;
    if (s.first>=x) {
        printf("! %d\n",s.first);
        fflush(stdout);
        return 0;
    }
    vector<PII> vec;
    vec.pb(s);
    for (int i=1;i<min(n,1000);i++) {
        while (true) {
            int idx=(((ll)rand()<<15)|rand())%n+1;
            if (!vis[idx]) {
                PII tmp=ask(idx);
                vec.pb(tmp);
                vis[idx]=true;
                break;
            }
        }
    }
    sort(vec.begin(),vec.end());
    int idx=0;
    while (idx<vec.size()&&vec[idx].first<x) idx++;
    int target=0;
    if (idx==vec.size()) {
        target=vec.back().second;
        if (target==-1) {
            printf("! -1\n");
            return 0;
        }
    } else {
        if (vec[idx].first==x) {
            printf("! %d\n",x);
            fflush(stdout);
            return 0;
        } else if (idx==0) {
            target=start;
        } else {
            target=vec[idx-1].second;
        }
    }

    int val=0;
    int nxt=0;
    printf("? %d\n",target);
    fflush(stdout);
    scanf("%d%d",&val,&nxt);
    while (val<x&&nxt!=-1) {
        printf("? %d\n",nxt);
        fflush(stdout);
        scanf("%d%d",&val,&nxt);
    }

    if (val>=x) printf("! %d\n",val);
    else printf("-1\n");
    fflush(stdout);
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

int n,start,x;

int main()
{
    scanf("%d%d%d",&n,&start,&x);
    int num=-1,pos=-1;
    int a,b;
    for (int i=0;i<n/50;i++) {
        ll tmp=rand();
        int idx=(tmp*tmp%n)+1;
        printf("? %d\n",idx);
        fflush(stdout);
        scanf("%d%d",&a,&b);
        if (a<x&&a>num) num=a,pos=b;
    }
    if (num==-1) pos=start;
    while (num<=x&&pos!=-1) {
        printf("? %d\n",pos);fflush(stdout);
        scanf("%d%d",&a,&b);
        if (a>=x) { printf("! %d\n",a); fflush(stdout); return 0; }
        pos=b;
    }
    printf("! -1\n");
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

int n,s,x;

int main()
{
    scanf("%d%d%d",&n,&s,&x);
    int num=-1;
    int a,b;
    for (int i=0;i<n/50;i++) {
        ll tmp=rand();
        int idx=(tmp*tmp%n)+1;
        printf("? %d\n",idx);
        fflush(stdout);
        scanf("%d%d",&a,&b);
        if (a<x&&a>num) num=a,s=b;
    }
    while (num<x) {
        printf("? %d\n",s);fflush(stdout);
        scanf("%d%d",&num,&s);
        if (s==-1) { printf("! -1\n"); fflush(stdout); return 0; }
    }
    printf("! %d\n",num);
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=50010;
int n,x,start;
bool vis[N];

PII ask(int a) {
    printf("? %d\n",a);
    fflush(stdout);
    int tmp=0;
    int nxt=0;
    scanf("%d%d",&tmp,&nxt);
    return {tmp,nxt};
}

int main()
{
    scanf("%d%d%d",&n,&start,&x);
    PII s=ask(start);
    vis[start]=1;
    if (s.first>=x) {
        printf("! %d\n",s.first);
        fflush(stdout);
        return 0;
    }
    vector<PII> vec;
    vec.pb(s);
    for (int i=1;i<min(n,1000);i++) {
        while (true) {
            int idx=(rand()%n)+1;
            if (!vis[idx]) {
                PII tmp=ask(idx);
                vec.pb(tmp);
                vis[idx]=true;
                break;
            }
        }
    }
    sort(vec.begin(),vec.end());
    int idx=0;
    while (idx<vec.size()&&vec[idx].first<x) idx++;
    int target=0;
    if (idx==vec.size()) {
        target=vec.back().second;
        if (target==-1) {
            printf("! %d\n",vec.back().first);
            return 0;
        }
    } else {
        if (vec[idx].first==x) {
            printf("! %d\n",x);
            fflush(stdout);
            return 0;
        } else if (idx==0) {
            target=start;
        } else {
            target=vec[idx-1].second;
        }
    }

    int val=0;
    int nxt=0;
    printf("? %d\n",target);
    fflush(stdout);
    scanf("%d%d",&val,&nxt);
    while (val<x&&nxt!=-1) {
        printf("? %d\n",nxt);
        fflush(stdout);
        scanf("%d%d",&val,&nxt);
    }

    printf("! %d\n",val);
    fflush(stdout);
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

int n,s,x;

int main()
{
    scanf("%d%d%d",&n,&s,&x);
    int num=-1;
    int a,b;
    for (int i=0;i<n/50;i++) {
        ll tmp=rand();
        int idx=(tmp*tmp%n)+1;
        printf("? %d\n",idx);
        fflush(stdout);
        scanf("%d%d",&a,&b);
        if (a<x&&a>num) num=a,s=b;
    }
    while (num<x) {
        if (s==-1) { printf("! -1\n"); fflush(stdout); return 0; }
        printf("? %d\n",s);fflush(stdout);
        scanf("%d%d",&num,&s);
    }
    printf("! %d\n",num);
}


#include <ctime>

#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=50010;
int n,x,start;
bool vis[N];

PII ask(int a) {
    printf("? %d\n",a);
    fflush(stdout);
    int tmp=0;
    int nxt=0;
    scanf("%d%d",&tmp,&nxt);
    return {tmp,nxt};
}

int main()
{
    srand(time(0));
    scanf("%d%d%d",&n,&start,&x);
    PII s=ask(start);
    vis[start]=1;
    if (s.first>=x) {
        printf("! %d\n",s.first);
        fflush(stdout);
        return 0;
    }
    vector<PII> vec;
    vec.pb(s);
    for (int i=1;i<min(n,1000);i++) {
        while (true) {
            int idx=(rand()%n)+1;
            if (!vis[idx]) {
                PII tmp=ask(idx);
                vec.pb(tmp);
                vis[idx]=true;
                break;
            }
        }
    }
    sort(vec.begin(),vec.end());
    int idx=0;
    while (idx<vec.size()&&vec[idx].first<x) idx++;
    int target=0;
    if (idx==vec.size()) {
        target=vec.back().second;
        if (target==-1) {
            printf("! -1\n");
            return 0;
        }
    } else {
        if (vec[idx].first==x) {
            printf("! %d\n",x);
            fflush(stdout);
            return 0;
        } else if (idx==0) {
            target=start;
        } else {
            target=vec[idx-1].second;
        }
    }

    int val=0;
    int nxt=0;
    printf("? %d\n",target);
    fflush(stdout);
    scanf("%d%d",&val,&nxt);
    while (val<x&&nxt!=-1) {
        printf("? %d\n",nxt);
        fflush(stdout);
        scanf("%d%d",&val,&nxt);
    }

    printf("! %d\n",val);
    fflush(stdout);
}


#include <ctime>

#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=50010;
int n,x,start;
bool vis[N];

PII ask(int a) {
    printf("? %d\n",a);
    fflush(stdout);
    int tmp=0;
    int nxt=0;
    scanf("%d%d",&tmp,&nxt);
    return {tmp,nxt};
}

int main()
{
    srand(time(0)+INF);
    scanf("%d%d%d",&n,&start,&x);
    PII s=ask(start);
    vis[start]=1;
    if (s.first>=x) {
        printf("! %d\n",s.first);
        fflush(stdout);
        return 0;
    }
    vector<PII> vec;
    vec.pb(s);
    for (int i=1;i<min(n,1000);i++) {
        while (true) {
            int idx=(rand()%n)+1;
            if (!vis[idx]) {
                PII tmp=ask(idx);
                vec.pb(tmp);
                vis[idx]=true;
                break;
            }
        }
    }
    sort(vec.begin(),vec.end());
    int idx=0;
    while (idx<vec.size()&&vec[idx].first<x) idx++;
    int target=0;
    if (idx==vec.size()) {
        target=vec.back().second;
        if (target==-1) {
            printf("! -1\n");
            return 0;
        }
    } else {
        if (vec[idx].first==x) {
            printf("! %d\n",x);
            fflush(stdout);
            return 0;
        } else if (idx==0) {
            target=start;
        } else {
            target=vec[idx-1].second;
        }
    }

    int val=0;
    int nxt=0;
    printf("? %d\n",target);
    fflush(stdout);
    scanf("%d%d",&val,&nxt);
    while (val<x&&nxt!=-1) {
        printf("? %d\n",nxt);
        fflush(stdout);
        scanf("%d%d",&val,&nxt);
    }

    printf("! %d\n",val);
    fflush(stdout);
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=50010;
int n,x,start;
bool vis[N];

PII ask(int a) {
    printf("? %d\n",a);
    fflush(stdout);
    int tmp=0;
    int nxt=0;
    scanf("%d%d",&tmp,&nxt);
    return {tmp,nxt};
}

int main()
{
    scanf("%d%d%d",&n,&start,&x);
    PII s=ask(start);
    vis[start]=1;
    if (s.first>=x) {
        printf("! %d\n",s.first);
        fflush(stdout);
        return 0;
    }
    vector<PII> vec;
    vec.pb(s);
    for (int i=1;i<min(n,1000);i++) {
        while (true) {
            int idx=(rand()%n)+1;
            if (!vis[idx]) {
                PII tmp=ask(idx);
                vec.pb(tmp);
                vis[idx]=true;
                break;
            }
        }
    }
    sort(vec.begin(),vec.end());
    int idx=0;
    while (idx<vec.size()&&vec[idx].first<x) idx++;
    int target=0;
    if (idx==vec.size()) {
        target=vec.back().second;
        if (target==-1) {
            printf("! -1\n");
            return 0;
        }
    } else {
        if (vec[idx].first==x) {
            printf("! %d\n",x);
            fflush(stdout);
            return 0;
        } else if (idx==0) {
            target=start;
        } else {
            target=vec[idx-1].second;
        }
    }

    int val=0;
    int nxt=0;
    printf("? %d\n",target);
    fflush(stdout);
    scanf("%d%d",&val,&nxt);
    while (val<x&&nxt!=-1) {
        printf("? %d\n",nxt);
        fflush(stdout);
        scanf("%d%d",&val,&nxt);
    }

    printf("! %d\n",val);
    fflush(stdout);
}


#include <ctime>

#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=50010;
int n,x,start;
bool vis[N];

PII ask(int a) {
    printf("? %d\n",a);
    fflush(stdout);
    int tmp=0;
    int nxt=0;
    scanf("%d%d",&tmp,&nxt);
    return {tmp,nxt};
}

int main()
{
    srand(time(0)+INF);
    scanf("%d%d%d",&n,&start,&x);
    PII s=ask(start);
    vis[start]=1;
    if (s.first>=x) {
        printf("! %d\n",s.first);
        fflush(stdout);
        return 0;
    }
    vector<PII> vec;
    vec.pb(s);
    for (int i=1;i<min(n,1000);i++) {
        while (true) {
            int idx=(((ll)rand()<<15)|rand())%n+1;
            if (!vis[idx]) {
                PII tmp=ask(idx);
                vec.pb(tmp);
                vis[idx]=true;
                break;
            }
        }
    }
    sort(vec.begin(),vec.end());
    int idx=0;
    while (idx<vec.size()&&vec[idx].first<x) idx++;
    int target=0;
    if (idx==vec.size()) {
        target=vec.back().second;
        if (target==-1) {
            printf("! -1\n");
            return 0;
        }
    } else {
        if (vec[idx].first==x) {
            printf("! %d\n",x);
            fflush(stdout);
            return 0;
        } else if (idx==0) {
            target=start;
        } else {
            target=vec[idx-1].second;
        }
    }

    int val=0;
    int nxt=0;
    printf("? %d\n",target);
    fflush(stdout);
    scanf("%d%d",&val,&nxt);
    while (val<x&&nxt!=-1) {
        printf("? %d\n",nxt);
        fflush(stdout);
        scanf("%d%d",&val,&nxt);
    }

    printf("! %d\n",val);
    fflush(stdout);
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
inline PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	si(tmp.F);
	si(tmp.S);
	return tmp;
}
inline void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
inline int getRand(int n)
{
	return 1+abs( rand() << 15 + rand() )%n;
}
int main()
{
    int n , start, x;
    si(n);
    si(start);
    si(x);
    srand(time(0));
    set<int>numbers;
    numbers.insert(start);
    while((int)numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
   	sort( all(ans) );
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
inline PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	si(tmp.F);
	si(tmp.S);
	return tmp;
}
inline void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
inline int getRand(int n)
{
	return 1+abs( (rand() << 15) + rand() )%n;
}
int main()
{
    int n , start, x;
    si(n);
    si(start);
    si(x);
    srand(time(0));
    set<int>numbers;
    //numbers.insert(start);
    while((int)numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
   	sort( all(ans) );
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	cin >> tmp.F >> tmp.S;
	return tmp;
}
void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
int getRand(int n)
{
	return abs( rand() << 15 + rand() )%n + 1;
}
int main()
{
    int n , start, x;
    cin >> n >> start >> x;
    set<int>numbers;
    srand(time(0));
    while(numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
inline PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	cin >> tmp.F >> tmp.S;
	return tmp;
}
inline void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
int getRand(int n)
{
	return abs( rand() << 15 + rand() )%n + 1;
}
int main()
{
    int n , start, x;
    cin >> n >> start >> x;
    set<int>numbers;
    numbers.insert(start);
    srand(time(0));
    while((int)numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
   	sortv(ans);
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	cin >> tmp.F >> tmp.S;
	return tmp;
}
void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
int getRand(int n)
{
	return abs( rand() << 15 + rand() )%n + 1;
}
int main()
{
    int n , start, x;
    cin >> n >> start >> x;
    set<int>numbers;
    srand(time(0));
    while(numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    		finish(it.first);
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	cin >> tmp.F >> tmp.S;
	return tmp;
}
void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
int getRand(int n)
{
	return abs( rand() << 15 + rand() )%n + 1;
}
int main()
{
    int n , start, x;
    cin >> n >> start >> x;
    set<int>numbers;
    srand(time(0));
    while(numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
   	sortv(ans);
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

inline pair <int, int> ask(int id) {
  printf("? %d\n", id);
  fflush(stdout);
  pair <int, int> p;
  scanf("%d %d", &p.first, &p.second);
  return p;
}

inline void finish(int value) {
  printf("! %d\n", value);
  fflush(stdout);
  exit(0);
}

inline int RAND(int n) {
  return abs((rand() << 15) + rand()) % n;
}

const int MAGIC = 1000;

int main() {
  int n, start, x;
  scanf("%d %d %d", &n, &start, &x);
  srand(time(0));
  set <int> all;
  all.insert(start);
  while ((int) all.size() < min(n, MAGIC)) {
    all.insert(RAND(n) + 1);
  }
  vector < pair <int, int> > v;
  for (int i : all) {
    pair <int, int> z = ask(i);
    v.emplace_back(z.first, i);
  }
  sort(v.begin(), v.end());
  int ptr = start;
  for (int i = 0; i < (int) v.size(); i++) {
    if (v[i].first < x) {
      ptr = v[i].second;
    }
  }
  while (ptr != -1) {
    pair <int, int> z = ask(ptr);
    if (z.first >= x) {
      finish(z.first);
      return 0;
    }
    ptr = z.second;
  }
  finish(-1);
  return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
inline PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	si(tmp.F);
	si(tmp.S);
	return tmp;
}
inline void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
int getRand(int n)
{
	return abs( rand() << 15 + rand() )%n + 1;
}
int main()
{
    int n , start, x;
    si(n);
    si(start);
    si(x);
    srand(time(0));
    set<int>numbers;
    numbers.insert(start);
    while((int)numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
   	sort( all(ans) );
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
inline PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	si(tmp.F);
	si(tmp.S);
	return tmp;
}
inline void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
inline int getRand(int n)
{
	return 1+abs( (rand() << 15) + rand() )%n;
}
int main()
{
    int n , start, x;
    si(n);
    si(start);
    si(x);
    srand(time(0));
    set<int>numbers;
    numbers.insert(start);
    while((int)numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
   	sort( all(ans) );
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b and n>=a)
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define sd(n) scanf("%d",&n)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;

#define MOD 1000000007ll
LL modpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
inline PII ask(int id)
{
	printf("? %d\n",id);
	fflush(stdout);
	PII tmp;
	si(tmp.F);
	si(tmp.S);
	return tmp;
}
inline void finish(int id)
{
	printf("! %d\n",id);
	fflush(stdout);
	exit(0);
}
int getRand(int n)
{
	return abs( rand() << 15 + rand() )%n + 1;
}
int main()
{
    int n , start, x;
    cin >> n >> start >> x;
    set<int>numbers;
    numbers.insert(start);
    srand(time(0));
    while((int)numbers.size() < min(n,1000) )
    	numbers.insert(getRand(n));
    vector< PII > ans;
    for(int i : numbers)
    	ans.PB( MP(ask(i).F,i));
   	sortv(ans);
    int ptr = start;
    for(auto it : ans)
    {
    	if(it.first < x)
    		ptr = it.second;
    }
    while(ptr != -1)
    {
    	auto it = ask(ptr);
    	if(it.first >= x)
    	{
    		finish(it.first);
    		return 0;
    	}
    	ptr = it.second;
    }
    finish(-1);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=1e9,nxt[maxn];
bool vis[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	vis[pos]=1;
	int x=read<int>(),y=read<int>();
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	n=read<int>();
	st=read<int>();
	k=read<int>();
	ask(st);
	int times=0;
	REP(i,2,1000){
		int t=rand()%n+1;
		bool mark=0;
		while(vis[t]){
			if(++times>=1000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	int pos=(*it).y;
	if(vis[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=1e9,nxt[maxn];
bool vis[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	vis[pos]=1;
	int x=read<int>(),y=read<int>();
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	n=read<int>();
	st=read<int>();
	k=read<int>();
	ask(st);
	int times=0;
	REP(i,2,1000){
		int t=rand()%n+1;
		bool mark=0;
		while(vis[t]){
			if(++times>=1000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	--it;
	int pos=(*it).y;
//	cout<<ans<<endl;
	if(vis[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=1e9,nxt[maxn];
bool vis[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	vis[pos]=1;
	int x=read<int>(),y=read<int>();
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	n=read<int>();
	st=read<int>();
	k=read<int>();
	ask(st);
	REP(i,2,1000){
		int t=rand()%n+1;
		int times=0;
		bool mark=0;
		while(vis[t]){
			if(++times>=n){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	int pos=(*it).y;
	if(vis[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){if(ask(pos))break;pos=nxt[pos];}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=1e9,nxt[maxn];
bool vis[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	vis[pos]=1;
	int x=read<int>(),y=read<int>();
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	n=read<int>();
	st=read<int>();
	k=read<int>();
	ask(st);
	int times=0;
	REP(i,2,1000){
		int t=rand()%n+1;
		bool mark=0;
		while(vis[t]){
			if(++times>=10000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	--it;
	int pos=(*it).y;
	if(vis[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005,inf=1e9;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=inf,nxt[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	int x,y;
	scanf("%d%d",&x,&y);
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	scanf("%d%d%d",&n,&st,&k);
	ask(st);
	if(ans<inf){
		printf("! %d\n",ans);
		return 0;
	}
	int times=0,mark=0;
	REP(i,2,1000){
		int t=rand()*rand()%n+1;
		while(nxt[t]){
			if(++times>=10000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	--it;
	int pos=(*it).y;
	if(nxt[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=1e9,nxt[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	int x,y;
	scanf("%d%d",&x,&y);
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	scanf("%d%d%d",&n,&st,&k);
	ask(st);
	int times=0,mark=0;
	REP(i,2,1000){
		int t=rand()%n+1;
		while(nxt[t]){
			if(++times>=10000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	--it;
	int pos=(*it).y;
	if(nxt[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005,inf=1e9;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=inf,nxt[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	int x,y;
	scanf("%d%d",&x,&y);
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	scanf("%d%d%d",&n,&st,&k);
	ask(st);
	if(ans<inf){
		printf("! %d\n",ans);
		return 0;
	}
	int times=0,mark=0;
	REP(i,2,1000){
		int t=rand()%n+1;
		while(nxt[t]){
			if(++times>=10000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	--it;
	int pos=(*it).y;
	if(nxt[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=1e9,nxt[maxn];
bool vis[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	vis[pos]=1;
	int x=read<int>(),y=read<int>();
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	n=read<int>();
	st=read<int>();
	k=read<int>();
	ask(st);
	int times=0;
	REP(i,2,1000){
		int t=rand()%n+1;
		bool mark=0;
		while(vis[t]){
			if(++times>=1000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	int pos=(*it).y;
//	cout<<ans<<endl;
	if(vis[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
namespace ioput{
#ifdef __linux__
	#define getchar getchar_unlocked
	#define putchar putchar_unlocked
#endif
	template<typename T>T read(){
		T x=0,f=1;
		char c=getchar();
		while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
		while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
		return x*f;
	}
	template<typename T>void write(T x,char c){
		static char t[25];
		static int tlen;
		t[tlen=1]=c;
		if(x<0)putchar('-'),x=-x;
		do t[++tlen]=(x%10)^48;
		while(x/=10);
		while(tlen)putchar(t[tlen--]);
	}
}
using namespace ioput;
const int maxn=50005;
struct data{
	int x,y;
	bool operator < (const data &A) const {
		return x<A.x;
	}
};
set<data>s;
int n,st,k,ans=1e9,nxt[maxn];
bool ask(int pos){
	printf("? %d\n",pos);
	fflush(stdout);
	int x,y;
	scanf("%d%d",&x,&y);
	nxt[pos]=y;
	s.insert((data){x,y});
	if(x>=k){
		ans=min(ans,x);
		return 1;
	}return 0;
}
int main(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
#endif
	srand(1004535809);
	scanf("%d%d%d",&n,&st,&k);
	ask(st);
	int times=0,mark=0;
	REP(i,2,1200){
		int t=rand()%n+1;
		while(nxt[t]){
			if(++times>=10000000){mark=1;break;}
			t=rand()%n+1;
		}
		if(mark==1)break;
		ask(t);
	}
	set<data>::iterator it=s.lower_bound((data){k,0});
	--it;
	int pos=(*it).y;
	if(nxt[pos]){
		printf("! %d\n",ans);
		return 0;
	}
	while(1){
		if(pos==-1){ans=-1;break;}
		if(ask(pos))break;
		pos=nxt[pos];
	}
	printf("! %d\n",ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz(a) int((a).size())
#define F first
#define S second

#define rep(i, a, b) for(int i = a; i < b; ++i)
#define per(i, a, b) for(int i = a; i >= b; --i)
#define travel(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define INDEX(arr,ind)          (lower_bound(all(arr),ind)-arr.begin())

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;

inline ll powmod(ll x, ll n, ll _mod){
  ll res = 1;
  while (n){
    if (n & 1)res = (res*x) % _mod;
    x = (x*x) % _mod;
    n >>= 1;
    }
    return res;
  }

#define N 100005
int n,start,x;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int val,nxt;
    cin>>n;
    cin>>start;
    cin>>x;

    if(n<1900){
        int ans=-1;
        rep(i,1,n+1){
            cout<<"? "<<i<<endl;
            cin>>val>>nxt;
            if(val>=x){
                if(ans==-1)ans=val;
                ans=min(ans,val);
            }
        }
        cout<<"! "<<ans<<endl;
        return 0;
    }

    set<pii> ovb;
    vpii overbridge;

    cout<<"? "<<start<<endl;
    cin>>val>>nxt;

    if(val>=x){
        cout<<"! "<<val<<endl;
        return 0;
    }
    //ovb.insert(mp(val,start));
    overbridge.pb(mp(val,start));

    int cur=1;
    rep(i,0,505){
        if(cur>n)break;
        if(cur==start){
            cur+=102;
            continue;
        }
        cout<<"? "<<cur<<endl;
        cin>>val>>nxt;

        overbridge.pb(mp(val,cur));
        //ovb.insert(mp(val,start));
        cur+=102;
    }
    // travel(ovb,itr){
    //     overbridge.pb(*itr);
    // }

    sort(all(overbridge));

    int idx=overbridge[0].S;
    rep(i,0,sz(overbridge)){
        if(overbridge[i].F>=x){
            break;
        }
        idx=overbridge[i].S;
    }

    cur=idx;
    rep(i,0,700){
        if(cur==-1)break;
        cout<<"? "<<cur<<endl;
        cin>>val>>nxt;
        if(val>=x){
            cout<<"! "<<val<<endl;
            return 0;
        }
        cur=nxt;
    }

    cur=overbridge[sz(overbridge)-1].S;
    rep(i,0,700){
        if(cur==-1)break;
        cout<<"? "<<cur<<endl;
        cin>>val>>nxt;
        if(val>=x){
            cout<<"! "<<val<<endl;
            return 0;
        }
        cur=nxt;
    }
    cout<<"! -1"<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz(a) int((a).size())
#define F first
#define S second

#define rep(i, a, b) for(int i = a; i < b; ++i)
#define per(i, a, b) for(int i = a; i >= b; --i)
#define travel(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define INDEX(arr,ind)          (lower_bound(all(arr),ind)-arr.begin())

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;

inline ll powmod(ll x, ll n, ll _mod){
  ll res = 1;
  while (n){
    if (n & 1)res = (res*x) % _mod;
    x = (x*x) % _mod;
    n >>= 1;
    }
    return res;
  }

#define N 50005
int n,start,x;
int a[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    srand(clock());
    int val,nxt;
    cin>>n>>start>>x;

    rep(i,1,n+1){
        a[i]=i;
    }
    random_shuffle(a+1,a+1+n);
    int idx=-1,mx=-1;
    rep(i,1,min(n+1,1000)){
        cout<<"? "<<a[i]<<endl;
        cin>>val>>nxt;
        if(val<=x){
            if(val>mx){
                mx=val;
                idx=i;
            }
        }
    }
    if(idx==-1)idx=start;
    rep(i,0,1000){
        if(idx==-1)break;
        cout<<"? "<<idx<<endl;
        cin>>val>>nxt;
        if(val>=x){
            cout<<"! "<<val<<endl;
            return 0;
        }
        idx=nxt;
    }
    cout<<"! -1"<<endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
const int C = 500;
const int N = 5e4 + 4;
int n , start , x;
int val , nxt;
int arr[N];
int main(){
	srand(clock());
	scanf("%d %d %d" , &n , &start , &x);
	for(int i = 1 ; i <= n ; ++i){
		arr[i] = i;
	}
	random_shuffle(arr + 1 , arr + 1 + n);
	int idx = -1;
	int mx = -1;
	for(int i = 1 ; i <= 999 && i <= n ; ++i){
		printf("? %d\n" , arr[i]);
		fflush(stdout);
		scanf("%d %d" , &val , &nxt);
		if(val <= x){
			if(val > mx){
				mx = val;
				idx = arr[i];
			}
		}
	}
	if(idx == -1){
		idx = start;
	}
	int steps = 0;
	do{
		printf("? %d\n" , idx);
		fflush(stdout);
		scanf("%d %d" , &val , &nxt);
		if(val >= x){
			printf("! %d\n" , val);
			fflush(stdout);
			return 0;
		}
		idx = nxt;
		++steps;
	}
	while(steps < 999 && idx != -1);
	printf("! -1\n");
	fflush(stdout);
}


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz(a) int((a).size())
#define F first
#define S second

#define rep(i, a, b) for(int i = a; i < b; ++i)
#define per(i, a, b) for(int i = a; i >= b; --i)
#define travel(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define INDEX(arr,ind)          (lower_bound(all(arr),ind)-arr.begin())

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;

inline ll powmod(ll x, ll n, ll _mod){
  ll res = 1;
  while (n){
    if (n & 1)res = (res*x) % _mod;
    x = (x*x) % _mod;
    n >>= 1;
    }
    return res;
  }

#define N 100005
int n,start,x;
int a[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int val,nxt;
    cin>>n;
    cin>>start;
    cin>>x;

    srand(clock());
    rep(i,1,n+1){
        a[i]=i;
    }
    random_shuffle(a+1,a+1+n);
    int idx=1,mx=0;
    rep(i,1,min(n,1000)){
        cout<<"? "<<a[i]<<endl;
        cin>>val>>nxt;
        if(val<=x){
            if(val>mx){
                mx=val;
                idx=i;
            }
        }
    }
    if(idx==-1)idx=start;
    rep(i,0,1000){
        if(idx==-1)break;
        cout<<"? "<<idx<<endl;
        cin>>val>>nxt;
        if(val>=x){
            cout<<"! "<<val<<endl;
            return 0;
        }
        idx=nxt;
    }
    cout<<"! -1"<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz(a) int((a).size())
#define F first
#define S second

#define rep(i, a, b) for(int i = a; i < b; ++i)
#define per(i, a, b) for(int i = a; i >= b; --i)
#define travel(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define INDEX(arr,ind)          (lower_bound(all(arr),ind)-arr.begin())

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;

inline ll powmod(ll x, ll n, ll _mod){
  ll res = 1;
  while (n){
    if (n & 1)res = (res*x) % _mod;
    x = (x*x) % _mod;
    n >>= 1;
    }
    return res;
  }

#define N 100005
int n,start,x;
int a[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int val,nxt;
    cin>>n;
    cin>>start;
    cin>>x;

    srand(clock());
    rep(i,1,n+1){
        a[i]=i;
    }
    random_shuffle(a+1,a+1+n);
    int idx=1,mx=0;
    rep(i,1,1000){
        cout<<"? "<<a[i]<<endl;
        cin>>val>>nxt;
        if(val<=x){
            if(val>mx){
                mx=val;
                idx=i;
            }
        }
    }
    if(idx==-1)idx=start;
    rep(i,0,1000){
        cout<<"? "<<idx<<endl;
        cin>>val>>nxt;
        if(val>=x){
            cout<<"! "<<val<<endl;
            return 0;
        }
        idx=nxt;
    }
    cout<<"! -1"<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz(a) int((a).size())
#define F first
#define S second

#define rep(i, a, b) for(int i = a; i < b; ++i)
#define per(i, a, b) for(int i = a; i >= b; --i)
#define travel(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define INDEX(arr,ind)          (lower_bound(all(arr),ind)-arr.begin())

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;

inline ll powmod(ll x, ll n, ll _mod){
  ll res = 1;
  while (n){
    if (n & 1)res = (res*x) % _mod;
    x = (x*x) % _mod;
    n >>= 1;
    }
    return res;
  }

#define N 50005
int n,start,x;
int a[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    srand(clock());
    int val,nxt;
    cin>>n>>start>>x;

    rep(i,1,n+1){
        a[i]=i;
    }
    random_shuffle(a+1,a+1+n);
    int idx=-1,mx=-1;
    rep(i,1,min(n+1,1000)){
        cout<<"? "<<a[i]<<endl;
        cin>>val>>nxt;
        if(val<=x){
            if(val>mx){
                mx=val;
                idx=a[i];
            }
        }
    }
    if(idx==-1)idx=start;
    rep(i,0,1000){
        if(idx==-1)break;
        cout<<"? "<<idx<<endl;
        cin>>val>>nxt;
        if(val>=x){
            cout<<"! "<<val<<endl;
            return 0;
        }
        idx=nxt;
    }
    cout<<"! -1"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 500){
        go(rand() % n + 1);
    }
    int cnt = 1499;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    cout << '!' _ sol.first << "\n";
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 500){
        go(rand() % n + 1);
    }

    while(sol.first < x && sol.second != -1){
        go(sol.second);
    }
    cout << '!' _ sol.first << "\n";
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 5){
        go(rand() % n + 1);
    }
    int cnt = 1497;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
    else if(id == start && a > x){
        sol = point(a, -10);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 1000){
        ll random = rand() % 10007 * rand() + rand() % 123456 + rand();
        random = random % n + 1;
        go(random);
    }
    if(sol.second == -10 && sol.first >= x){
        cout << '!' _ sol.first << "\n";
        exit(0);
    }
    int cnt = 997;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 1000){
        go(rand() % n + 1);
    }
    int cnt = 997;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 1000){
        ll random = rand() % 10007 * rand() + rand() % 123456 + rand();
        random = random % n + 1;
        go(random);
    }
    int cnt = 997;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 500){
        go(rand() % n + 1);
    }
    int cnt = 1497;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 1000){
        ll random = rand() % 10007 * rand() + rand();
        random = random % n + 1;
        go(random);
    }
    int cnt = 997;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 500){
        go(rand() % n + 1);
    }
    int cnt = 1498;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    cout << '!' _ sol.first << "\n";
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x, cnt;
point sol;
bool bio[MAXN];

void go(int id){
    cnt ++; bio[id] = true;
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    bio[start] = true;
    srand(time(NULL));
    REP(i, 700){
        if(cnt == n) break;
        int x = rand() % n + 1;
        while(bio[x]){
            x = rand() % n + 1;
        }
        go(rand() % n + 1);
    }
    cnt = 1297;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 500){
        go(rand() % n + 1);
    }
    int cnt = 1497;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 600){
        go(rand() % n + 1);
    }
    int cnt = 1397;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1005;

int n, start, x;
point sol;

void go(int id){
    cout << '?' _ id << "\n";
    fflush(stdout);
    int a, b; cin >> a >> b;
    if(a == x){
        cout << '!' _ a;
        exit(0);
    }
    if(a < x && a > sol.first){
        sol = point(a, b);
    }
    else if(id == start){
        sol = point(a, -10);
    }
}

int main(){
    sol = point(-1, -1);
    cin >> n >> start >> x;
    go(start);
    srand(time(NULL));
    REP(i, 1000){
        ll random = rand() % 10007 * rand() + rand() % 123456 + rand();
        random = random % n + 1;
        go(random);
    }
    if(sol.second == -10 && sol.first >= x){
        cout << '!' _ sol.first << "\n";
        exit(0);
    }
    int cnt = 997;
    while(sol.first < x && sol.second != -1 && cnt--){
        go(sol.second);
    }
    if(sol.second == -1){
        cout << '!' _ -1 << "\n";
    }
    else{
        cout << '?' _ sol.second << "\n";
        fflush(stdout);
        int a, b; cin >> a >> b;
        cout << '!' _ a << "\n";
    }
}


/* You lost the game. */

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626

#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x,s,v,r,v2,r2;
    int pp = -1, suiv = -1, minv = mod;
    siii(n,s,x);
    int p = 1+(n-1)/1000;
    for(int i = 1; i <= n; i += p) {
        printf("? %d\n", i);
        fflush(stdout);
        sii(v, r);
        if (v < x && v > pp) { pp = v; suiv = r; }
        minv = min(minv, v);
    }
    if (pp == -1) { printf("! %d\n", minv); }
    else if (suiv == -1) { printf("! -1\n"); }
    else {
        v = -1;
        while (v < x && suiv >= 0) {
            printf("? %d\n", suiv);
            fflush(stdout);
            sii(v, suiv);
        }
        if (suiv == -1) { printf("! -1\n"); }
        else { printf("! %d\n", v); }
    }
    return 0;

}


#include <bits/stdc++.h>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back((x))
#define vi vector<int>
#define vvi vector<vi>

using namespace std;

string itos(int x){
	stringstream ss;
	ss << x;
	return ss.str();
}

int T[200010], n, st, k;

int getRand(){
	return rand()^(rand()<<1);
}

int ask(int val, int id = 1, int l = 0, int r = n){
	T[id]++;
	if(l+1 == r) return l;
	int mid = l+r>>1;
	int rem = val-(mid-l)+T[id<<1];
	if(rem >= 0) return ask(rem, id<<1|1, mid, r);
	else return ask(val, id<<1, l, mid);
}

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	srand(time(NULL));
	cin >> n >> st >> k;
	if(n < 2000){
		int res = INF, x, nxt;
		for(int i = 1; i <= n; i++){
			cout << "? " << i << endl;
			cin >> x >> nxt;
			if(x >= k) res = min(x, res);
		}
		cout << "! " << (res == INF? -1: res) << endl;
		return 0;
	}
	else{
		int mx = -1, mxpos = -1, x, nxt;
		cout << "? " << ask(--st)+1 << endl; //*banghead EVEN HARDER
		cin >> x >> nxt;
		if(x < k){
				if(mx < x){
					mx = x;
					mxpos = nxt;
				}
			}
		else{
			cout << "! " << x << endl;
			return 0;
		}
		for(int i = 2, rem = n; i < 1000; i++, rem--){
			int pos = getRand()%rem;
			pos = ask(pos);
			assert(pos < n);
			cout << "? " << ++pos << endl;
			cin >> x >> nxt;
			if(x < k){
				if(mx < x){
					mx = x;
					mxpos = nxt;
				}
			}
		}
		for(int i = 0; i < 1000; i++){
			if(mxpos == -1) break;
			cout << "? " << mxpos << endl;
			cin >> x >> nxt;
			mxpos = nxt;
			if(x >= k){
				cout << "! " << x << endl;
				return 0;
			}
		}
		cout << "! " << -1 << endl;
	}
	return 0;
}


/* You lost the game. */

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626

#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x,s,v,r,v2,r2;
    int pp = -1, suiv = -1, minv = mod;
    siii(n,s,x);
    D pm = 1;
    int p = 0;
    if (n >= 2000) {
    int m = 1999;
    fin2(i, 1, 1999) {
        if (pow(((D) (n - m + i)) / (D) n, (D) i) < pm) { pm = pow(((D) (n - m + i)) / (D) n, (D) i); p = i; }
    }
    }
    else { p = min(1500, n); }
    for(int i = 1; i <= p; i++) {
        int lol = rand();
        int output = (n < 2000) ? i : rand() % n + 1;
        printf("? %d\n", output);
        fflush(stdout);
        sii(v, r);
        if (v < x && v > pp) { pp = v; suiv = r; }
        minv = min(minv, v);
    }
    if (pp == -1) { printf("! %d\n", minv); }
    else if (suiv == -1) { printf("! -1\n"); }
    else {
        v = -1;
        while (v < x && suiv > 0) {
            printf("? %d\n", suiv);
            fflush(stdout);
            sii(v, suiv);
        }
        if (v < x) { printf("! -1\n"); }
        else { printf("! %d\n", v); }
    }
    return 0;

}


/* You lost the game. */

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626

#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x,s,v,r,v2,r2;
    int pp = -1, suiv = -1, minv = mod;
    siii(n,s,x);
    D pm = 1;
    int p = 0;
    int m = min(1999, n);
    fin2(i, 1, 1999) {
        if (pow(((D) (n - m + i)) / (D) n, (D) i) < pm) { pm = pow(((D) (n - m + i)) / (D) n, (D) i); p = i; }
    }
    for(int i = 1; i <= p; i ++) {
        int lol = rand();
        int output = rand() % n + 1;
        printf("? %d\n", output);
        fflush(stdout);
        sii(v, r);
        if (v < x && v > pp) { pp = v; suiv = r; }
        minv = min(minv, v);
    }
    if (pp == -1) { printf("! %d\n", minv); }
    else if (suiv == -1) { printf("! -1\n"); }
    else {
        v = -1;
        while (v < x && suiv > 0) {
            printf("? %d\n", suiv);
            fflush(stdout);
            sii(v, suiv);
        }
        if (v < x) { printf("! -1\n"); }
        else { printf("! %d\n", v); }
    }
    return 0;

}


/* You lost the game. */

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626

#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x,s,v,r,v2,r2;
    int pp = -1, suiv = -1, minv = mod;
    siii(n,s,x);
    D pm = 1;
    int p = 0;
    if (n >= 2000) {
    int m = 1999;
    fin2(i, 1, 1999) {
        if (pow(((D) (n - m + i)) / (D) n, (D) i) < pm) { pm = pow(((D) (n - m + i)) / (D) n, (D) i); p = i; }
    }
    }
    else { p = n; }
    for(int i = 1; i <= p; i ++) {
        int lol = rand();
        int output = rand() % n + 1;
        printf("? %d\n", output);
        fflush(stdout);
        sii(v, r);
        if (v < x && v > pp) { pp = v; suiv = r; }
        minv = min(minv, v);
    }
    if (pp == -1) { printf("! %d\n", minv); }
    else if (suiv == -1) { printf("! -1\n"); }
    else {
        v = -1;
        while (v < x && suiv > 0) {
            printf("? %d\n", suiv);
            fflush(stdout);
            sii(v, suiv);
        }
        if (v < x) { printf("! -1\n"); }
        else { printf("! %d\n", v); }
    }
    return 0;

}


/* You lost the game. */

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626

#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x,s,v,r,v2,r2;
    int pp = -1, suiv = -1, minv = mod;
    siii(n,s,x);
    D pm = 1;
    int p = 0;
    if (n >= 2000) {
    int m = 1999;
    fin2(i, 1, 1999) {
        if (pow(((D) (n - m + i)) / (D) n, (D) i) < pm) { pm = pow(((D) (n - m + i)) / (D) n, (D) i); p = i; }
    }
    }
    else { p = n; }
    for(int i = 1; i <= p; i++) {
        int lol = rand();
        int output = (n < 2000) ? i : rand() % n + 1;
        printf("? %d\n", output);
        fflush(stdout);
        sii(v, r);
        if (v < x && v > pp) { pp = v; suiv = r; }
        minv = min(minv, v);
    }
    if (pp == -1) { printf("! %d\n", minv); }
    else if (suiv == -1) { printf("! -1\n"); }
    else {
        v = -1;
        while (v < x && suiv > 0) {
            printf("? %d\n", suiv);
            fflush(stdout);
            sii(v, suiv);
        }
        if (v < x) { printf("! -1\n"); }
        else { printf("! %d\n", v); }
    }
    return 0;

}


/* You lost the game. */

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626

#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x,s,v,r,v2,r2;
    int pp = mod, suiv = -1, minv = mod;
    siii(n,s,x);
    D pm = 1;
    int p = 0;
    if (n >= 2000) {
    int m = 1999;
    fin2(i, 1, 1999) {
        if (pow(((D) (n - m + i)) / (D) n, (D) i) < pm) { pm = pow(((D) (n - m + i)) / (D) n, (D) i); p = i; }
    }
    }
    else { p = n; }
    for(int i = 1; i <= p; i++) {
        int lol = rand();
        int output = (n < 2000) ? i : rand() % n + 1;
        printf("? %d\n", output);
        fflush(stdout);
        sii(v, r);
        if (v >= x && v < pp) { pp = v; suiv = r; }
        minv = min(minv, v);
    }
    if (pp == mod) { printf("! -1\n"); }
    else { printf("! %d\n", pp); }
    return 0;

}


/* You lost the game. */

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <pthread.h>

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626

#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &t[i]); }
#define sal(t,n) fin(i,n) { scanf("%lld", &t[i]); }
#define sad(t,n) fin(i,n) { scanf("%lf", &t[i]); }

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", t[i]); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", t[i]); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", t[i]); } printf("\n")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>

using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x,s,v,r,v2,r2;
    int pp = -1, suiv = -1, minv = mod;
    siii(n,s,x);
    int p = 1+(n-1)/800;
    for(int i = 1; i <= n; i += p) {
        printf("? %d\n", i);
        fflush(stdout);
        sii(v, r);
        if (v < x) {
            if (v > pp) {
                pp = v; suiv = r;
            }
            else if (v == pp) {
                printf("? %d\n", r);
                fflush(stdout);
                sii(v2, r2);
                if (v2 > v) { pp = v; suiv = r; }
            }
        }
        minv = min(minv, v);
    }
    if (pp == -1) { printf("! %d\n", minv); }
    else if (suiv == -1) { printf("! -1\n"); }
    else {
        v = -1;
        while (v < x) {
            printf("? %d\n", suiv);
            fflush(stdout);
            sii(v, suiv);
        }
        printf("! %d\n", v);
    }
    return 0;

}