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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 1 ; j <= n ; j ++)
        {
            if( arr[ j ] == -1 && j != p )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
                break ;
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 1 ; i <= n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v( siz ), v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    scanf("%d", &n ) ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    printf( "! %d %d\n", x, y ) ;
    scanf( "%d", &r ) ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 1 ; j <= n ; j ++)
        {
            if( arr[ j ] == -1 )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ )
    {
        if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;
    }

    printf( "! " );
    for( int i = 0 ; i < n ; i ++ ) printf( "%d ", arr[ i ] ) ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 2 ; j <= n ; j ++)
        {
            if( arr[ j ] == -1 )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 0 ; i < n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 1 ; j <= n ; j ++)
        {
            if( arr[ j ] == -1 && j != p )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
                break ;
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 0 ; i < n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 2 ; i <= n ; i ++ )
    {
        if( arr[ i ] == -1 )
        {
            int a = query( p, i ) ;
            int b = query( i, p ) ;
            st.erase( max( a, b ) ) ;
            if( b > a )
            {
                p = i ;
                arr[ p ] = b ;
            }
            else
            {
                arr[ p ] = a ;
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 0 ; i < n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1, cnt = n ;
    while( cnt -- )
    {
        for( int i = 1 ; i <= n ; i ++)
        {
            if( arr[ i ] == -1 && i != p )
            {
                int a = query( p, i ) ;
                int b = query( i, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    arr[ p ] = b ;
                }
                else
                {
                    p = i ;
                    arr[ p ] = a ;
                }
                break ;
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 1 ; i <= n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v( siz ), v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    scanf("%d", &n ) ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    printf( "! %d %d\n", x, y ) ;
    scanf( "%d", &r ) ;
    return r ;
}

void Calculation()
{
    int x = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 1 ; j <= n ; j ++)
        {
            if( arr[ j ] != -1 )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ )
    {
        if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;
    }

    printf( "! " );
    for( int i = 0 ; i < n ; i ++ ) printf( "%d ", arr[ i ] ) ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1, cnt = n ;
    while( cnt -- )
    {
        for( int i = 1 ; i <= n ; i ++)
        {
            if( arr[ i ] == -1 && i != p )
            {
                int a = query( p, i ) ;
                int b = query( i, p ) ;
                st.erase( max( a, b ) ) ;
                if( a > b )
                {
                    arr[ p ] = a ;
                    p = i ;
                }
                else
                {
                    arr[ i ] = b ;
                }
                break ;
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 1 ; i <= n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


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

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 2 ; i <= n ; i ++ )
    {
        for( int j = 2 ; j <= n ; j ++)
        {
            if( arr[ j ] == -1 )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 0 ; i < n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    set<int> s;
    for (int i = 0; i < n; ++i)
    {
        s.insert(i+1);
    }
    int a[n];
    memset(a,-1,sizeof(a));
    int x1=1, x2=2;
    for (int i = 0; i < n; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[i]=t1;
            s.erase(t1);
            x1=x2;
        }
        else{
            a[(i+1)%n]=t2;
            s.erase(t2);
        }
        x2++;
    }
    cout<<"! ";
    for (int i = 0; i < n; ++i)
    {
        if(a[i]==-1){
            a[i]=*s.begin();
            s.erase(s.begin());
        }
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    int a[n+1];
    memset(a,-1,sizeof(a));
    int x1=1, x2=n;
    for (int i = 0; i < n-1; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[x1]=t1;
            x1++;
        }
        else{
            a[x2]=t2;
            x2--;
        }
    }
    for(int i=1; i<=n; ++i){
        if(a[i] == -1)
            a[i]=n;
    }
    cout<<"! ";
    for (int i = 1; i <= n; ++i)
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    int a[n+1];
    bool done[n+1]={};
    memset(a,-1,sizeof(a));
    int x1=1, x2=2;
    for (int i = 0; i < n; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[x1]=t1;
            done[t1]=1;
            x1=x2;
        }
        else{
            a[x2]=t2;
            done[t2]=1;
        }
        x2++;
        if(x2>n) break;
    }
    for(int i=1; i<=n; ++i){
        if(!done[i]){
            a[x1]=i;
        }
    }
    cout<<"! ";
    for (int i = 1; i <= n; ++i)
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    int a[n];
    memset(a,-1,sizeof(a));
    int x1=1, x2=2;
    for (int i = 0; i < n; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[i]=t1;
        }
        else{
            a[(i+1)%n]=t2;
        }
        x1++;
        x2++;
        if(i==n-2){
            x1=n;
            x2=1;
        }
    }
    cout<<"! ";
    for (int i = 0; i < n; ++i)
    {
        if(a[i]==-1) a[i]=n;
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    set<int> s;
    for (int i = 0; i < n; ++i)
    {
        s.insert(i+1);
    }
    int a[n];
    memset(a,-1,sizeof(a));
    int x1=1, x2=2;
    for (int i = 0; i < n; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[i]=t1;
            s.erase(t1);
        }
        else{
            a[(i+1)%n]=t2;
            s.erase(t2);
        }
        x1++;
        x2++;
        if(i==n-2){
            x1=n;
            x2=1;
        }
    }
    cout<<"! ";
    for (int i = 0; i < n; ++i)
    {
        if(a[i]==-1){
            a[i]=*s.begin();
            s.erase(s.begin());
        }
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    int a[n+1];
    int x1=1, x2=n;
    for (int i = 0; i < n-1; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[x1]=t1;
            x1++;
        }
        else{
            a[x2]=t2;
            x2--;
        }
        a[x1]=n;
    }
    cout<<"! ";
    for (int i = 1; i <= n; ++i)
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    int a[n+1];
    bool done[n+1]={};
    memset(a,-1,sizeof(a));
    int x1=1, x2=2;
    for (int i = 0; i < n; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[x1]=t1;
            done[t1]=1;
            x1=x2;
        }
        else{
            a[x2]=t2;
            done[t2]=1;
        }
        x2++;
        if(x2>n) break;
    }
    for(int i=1; i<=n; ++i){
        if(a[i] == -1)
            a[i]=n;
    }
    cout<<"! ";
    for (int i = 1; i <= n; ++i)
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


/*
   Username : moondancer
   Name : Moon Dancer
*/

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

#define int long long

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    set<int> s;
    for (int i = 0; i < n; ++i)
    {
        s.insert(i+1);
    }
    int a[n];
    memset(a,-1,sizeof(a));
    int x1=1, x2=2;
    for (int i = 0; i < n; ++i)
    {
        int t1,t2;
        cout<<"? "<<x1<<" "<<x2<<endl;
        cin>>t1;
        cout<<"? "<<x2<<" "<<x1<<endl;
        cin>>t2;
        if(t1>t2){
            a[i]=t1;
            s.erase(t1);
            x1=x2;
        }
        else{
            a[(i+1)%n]=t2;
            s.erase(t2);
        }
        x2++;
        if(x2>n) break;
    }
    cout<<"! ";
    for (int i = 0; i < n; ++i)
    {
        if(a[i]==-1){
            a[i]=*s.begin();
            s.erase(s.begin());
        }
        cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='? ';
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');

        cout<<s;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        s="";
        s+='? ';
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        cout<<s;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    fflush(stdout);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1<<" "<<left2;
        int k1,k2;
        cin>>k1;
        cout<<"? "<<left2<<" "<<left1;
        cin>>k2;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;
    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;

    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1+1<<" "<<left2+1<<endl;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        exit(0);
        cout<<"? "<<left2+1<<" "<<left1+1<<endl;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        exit(0);
        if(k1>k2)
        {
            ans[left1%n] = k1;
            left1 = i+2;
        }
        else
        {
            ans[left2%n]=k2;
            left2= i+2;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='? ';
        s+=(left1+'0');
        s+=(' ');
        s+=(left2+'0');

        cout<<s;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        s="";
        s+='? ';
        s+=(left2+'0');
        s+=(' ');
        s+=(left1+'0');
        cout<<s;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    fflush(stdout);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1<<" "<<left2;
        int k1,k2;
        cin>>k1;
        cout<<"? "<<left2<<" "<<left1;
        cin>>k2;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0;
    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;

    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='?';
        s+=(' ');
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
            break;
        s="";
        s+='?';
        s+=(' ');
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    fflush(stdout);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='?';
        s+=(' ');
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');

        cout<<s;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        s="";
        s+='?';
        s+=(' ');
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        cout<<s;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    exit();

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='?';
        s+=(' ');
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');

        cout<<s;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        s="";
        s+='?';
        s+=(' ');
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        cout<<s;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    fflush(stdout);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='? ';
        s+=(left1-'0');
        s+=(' ');
        s+=(left2-'0');

        cout<<s;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        s="";
        s+='? ';
        s+=(left2-'0');
        s+=(' ');
        s+=(left1-'0');
        cout<<s;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    fflush(stdout);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1<<" "<<left2;
        int k1,k2;
        cin>>k1;
        cout<<"? "<<left2<<" "<<left1;
        cin>>k2;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2a,s=0;
    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;

    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1<<" "<<left2;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        cout<<"? "<<left2<<" "<<left1;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1<<" "<<left2;
        cout.flush()
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        cout<<"? "<<left2<<" "<<left1;
        cout.flush()
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='?';
        s+=(' ');
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
            break;
        s="";
        s+='?';
        s+=(' ');
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1%n] = k1;
            left1 = i+2;
        }
        else
        {
            ans[left2%n]=k2;
            left2= i+2;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    fflush(stdout);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='?';
        s+=(' ');
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        exit(0);
        s="";
        s+='?';
        s+=(' ');
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        exit(0);
        if(k1>k2)
        {
            ans[left1%n] = k1;
            left1 = i+2;
        }
        else
        {
            ans[left2%n]=k2;
            left2= i+2;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1<<" "<<left2;
        cout.flush();
        int k1,k2;
        cin>>k1;
        if(k1==-1)
        break;
        cout<<"? "<<left2<<" "<<left1;
        cout.flush();
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='?';
        s+=(' ');
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        s="";
        s+='?';
        s+=(' ');
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        cout<<s<<endl;
        fflush(stdout);
        cin>>k2;
        if(k1>k2)
        {
            ans[left1%n] = k1;
            left1 = i+2;
        }
        else
        {
            ans[left2%n]=k2;
            left2= i+2;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        cout<<"? "<<left1<<" "<<left2;
        int k1,k2;
        cin>>k1;
        cout<<"? "<<left2<<" "<<left1;
        cin>>k2;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2a,s=0;
    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=a[i];
    }
    a[ind] = sum-s;

    run(ans);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)
{
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
int modInverse(ll a, ll m)
{ ll m0 = m;   ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) {
ll q = a / m;ll t = m; m = a % m, a = t; t = y;y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
void solve()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"! 1";return;
    }
    vector<int>ans(n,0);
    int left1=0,left2=1;
    for(int i=0;i<(n-1);i++){
        string s="";
        s+='?';
        s+=(' ');
        s+=((left1+1)+'0');
        s+=(' ');
        s+=((left2+1)+'0');
        fflush(stdout);
        cout<<s;
        fflush(stdout);
        int k1,k2;
        cin>>k1;
        if(k1==-1)
            break;
        s="";
        s+='?';
        s+=(' ');
        s+=((left2+1)+'0');
        s+=(' ');
        s+=((left1+1)+'0');
        fflush(stdout);
        cout<<s;
        fflush(stdout);
        cin>>k2;
        if(k2==-1)
        break;
        if(k1>k2)
        {
            ans[left1] = k1;
            left1 = i+1;
        }
        else
        {
            ans[left2]=k2;
            left2= i+1;
        }
    }
    int sum= (n*(n+1))/2,s=0,ind=-1;

    for(int i=0;i<n;i++)
    {
        if(ans[i]==0)
            ind=i;
        else
            s+=ans[i];
    }
    ans[ind] = sum-s;
    cout<<"! ";
    run(ans);
    fflush(stdout);

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output4.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n+1);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << "?" << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << "?" << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                i=max(i,j)+1;

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                j=max(i,j)+1;
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)==val.end())
          {
                if(f==1) res[i]=k;
                else res[j]=k;
                break;
          }
    }
    cout << "! " ;
    re(i,1,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << 1 << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << 1 << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                rep(k,n) if(s.find(k)==s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                rep(k,n) if(s.find(k)==s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)==val.end())
          {
                if(f==1) res[i]=k;
                else res[j]=k;
                break;
          }
    }
    cout << "! " ;
    rep(i,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n+1);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << "?" << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << "?" << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                re(k,1,n) if(s.find(k)==s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                re(k,1,n) if(s.find(k)==s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)==val.end())
          {
                if(f==1) res[j]=k;
                else res[i]=k;
                break;
          }
    }
    cout << "! " ;
    re(i,1,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << "?" << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << "?" << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                rep(k,n) if(s.find(k)==s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                rep(k,n) if(s.find(k)==s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)==val.end())
          {
                if(f==1) res[i]=k;
                else res[j]=k;
                break;
          }
    }
    cout << "! " ;
    rep(i,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n);
    i=0;
    j=1;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << 1 << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << 1 << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                rep(k,n) if(s.find(k)!=s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                rep(k,n) if(s.find(k)!=s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)!=val.end())
          {
                if(f==1) res[i]=k;
                else res[j]=k;
                break;
          }
    }
    cout << "! " ;
    rep(i,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << 1 << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << 1 << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                rep(k,n) if(s.find(k)!=s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                rep(k,n) if(s.find(k)!=s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)!=val.end())
          {
                if(f==1) res[i]=k;
                else res[j]=k;
                break;
          }
    }
    cout << "! " ;
    rep(i,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n+1);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << "?" << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << "?" << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                i=max(i,j)+1;

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                j=max(j,i)+1;
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)==val.end())
          {
                if(f==1) res[j]=k;
                else res[i]=k;
                break;
          }
    }
    cout << "! " ;
    re(i,1,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << "?" << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << "?" << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                re(k,1,n) if(s.find(k)==s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                re(k,1,n) if(s.find(k)==s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)==val.end())
          {
                if(f==1) res[i]=k;
                else res[j]=k;
                break;
          }
    }
    cout << "! " ;
    rep(i,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n);
    i=0;
    j=1;
    //cnt=0;
    set<ll> s;
    while(s.size()!=n)
    {
          cout << 1 << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << 1 << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                rep(k,n) if(s.find(k)!=s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                rep(k,n) if(s.find(k)!=s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    cout << "! " ;
    rep(i,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n+1);
    i=1;
    j=2;
    //cnt=0;
    set<ll> s;
    set<ll> val;
    f=0;
    while(s.size()!=n-1)
    {
          cout << "?" << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << "?" << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                val.insert(t1);
                if(s.size()==n-1)
                {
                      f=1;
                      break;
                }
                re(k,1,n) if(s.find(k)==s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s.insert(j);
                val.insert(t2);
                if(s.size()==n-1)
                {
                      f=2;
                      break ;
                }
                re(k,1,n) if(s.find(k)==s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    for(k=1;k<=n;++k)
    {
          if(val.find(k)==val.end())
          {
                if(f==1) res[i]=k;
                else res[j]=k;
                break;
          }
    }
    cout << "! " ;
    re(i,1,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define re(i,a,n) for(i=a;i<=n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return binpow(n, p-2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m,n,i,f=0,j,ans=0,k,x,r,l,t,y,t1,t2;
    cin >> n ;
    if(n==1)
    {
          cout << "! 1" << endl ;
          return 0;
    }
    vector<ll> res(n);
    i=0;
    j=1;
    cnt=0;
    ste<ll> s;
    while(s.size()!=n)
    {
          cout << 1 << " " << i << " " << j << endl ;
          cin >> t1 ;
          cout << 1 << " " << j << " " << i << endl ;
          cin >> t2 ;
          if(t1>t2)
          {
                //i=t1;
                res[i]=t1;
                s.insert(i);
                rep(k,n) if(s.find(k)!=s.end()&&k!=j)
                {
                      i=k;
                      break;
                }

          }
          else
          {
                res[j]=t2;
                s,insert(j);
                rep(k,n) if(s.find(k)!=s.end()&&k!=i)
                {
                      j=k;
                      break;
                }
          }

    }
    cout << "! " ;
    rep(i,n) cout << res[i] << " " ;
    cout << endl ;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<"! 1";
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int count = 0;

		while (count < n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] == -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1)<<"\n";
			cout.flush();
			cin>>fir;

			if (fir == -1)
				exit(0);

			cout<<"? "<<(J + 1)<<" "<<(I + 1)<<"\n";
			cout.flush();
			cin>>sec;

			if (sec == -1)
				exit(0);

			if (fir > sec)
				ans[I] = fir;
			else
				ans[J] = sec;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
			{
				ans[i] = n;
				break;
			}
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
		}
		exit(0);
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<1;
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int count = 0;

		while (count < n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] == -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1)<<"\n";
			cout.flush();
			cin>>fir;

			if (fir == -1)
				exit(0);

			cout<<"? "<<(J + 1)<<" "<<(I + 1)<<"\n";
			cout.flush();
			cin>>sec;

			if (sec == -1)
				exit(0);

			if (fir > sec)
				ans[I] = fir;
			else
				ans[J] = fir;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
			{
				ans[i] = n;
				break;
			}
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
		}
		exit(0);
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<1;
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int i = 1;
		int count = 0;

		while (count != n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] != -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1)<<endl;
			cin>>fir;
			cout<<"? "<<(J + 1)<<" "<<(I + 1)<<endl;
			cin>>sec;

			if (fir > sec)
				ans[I] = fir;
			else
				ans[J] = sec;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
				ans[i] = n;
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
			exit(0);
		}
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<1;
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int count = 0;

		while (count < n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] == -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1)<<"\n";
			cout.flush();
			cin>>fir;

			if (fir == -1)
				exit(0);

			cout<<"? "<<(J + 1)<<" "<<(I + 1)<<"\n";
			cout.flush();
			cin>>sec;

			if (sec == -1)
				exit(0);

			if (fir > sec)
				ans[I] = fir;
			else
				ans[J] = sec;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
			{
				ans[i] = n;
				break;
			}
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
		}
		exit(0);
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<1;
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int i = 1;
		int count = 0;

		while (count != n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] == -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1);
			cout.flush();
			cin>>fir;
			cout<<"? "<<(J + 1)<<" "<<(I + 1);
			cout.flush()
			cin>>sec;

			if (fir > sec)
				ans[I] = fir;
			else
				ans[J] = sec;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
				ans[i] = n;
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
			exit(0);
		}
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<1;
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int i = 1;
		int count = 0;

		while (count < n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] == -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1)<<"\n";
			cout.flush();
			cin>>fir;

			if (fir == -1)
				exit(0);

			cout<<"? "<<(J + 1)<<" "<<(I + 1)<<"\n";
			cout.flush();
			cin>>sec;

			if (sec == -1)
				exit(0);

			if (fir > sec)
				ans[I] = fir;
			else
				ans[J] = sec;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
			{
				ans[i] = n;
				break;
			}
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
			exit(0);
		}
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<1;
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int i = 1;
		int count = 0;

		while (count < n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] == -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1)<<"\n";
			cout.flush();
			cin>>fir;

			if (fir == -1)
				exit(0);

			cout<<"? "<<(J + 1)<<" "<<(I + 1)<<"\n";
			cout.flush();
			cin>>sec;

			if (sec == -1)
				exit(0);

			if (fir > sec)
				ans[J] = fir;
			else
				ans[I] = fir;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
			{
				ans[i] = n;
				break;
			}
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
			exit(0);
		}
	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
	int n; cin>>n;

	if (n == 1)
	{
		cout<<1;
		exit(0);
	}
	else
	{
		vector<int> ans(n, -1);
		int i = 1;
		int count = 0;

		while (count != n - 1)
		{
			int I = -1, J = -1;

			for (int i = 0; i < n; i++)
			{
				if (ans[i] == -1)
				{
					if (I == -1)
						I = i;
					else
					{
						J = i;
						break;
					}
				}
			}

			int fir, sec;

			cout<<"? "<<(I + 1)<<" "<<(J + 1);
			cout.flush();
			cin>>fir;
			cout<<"? "<<(J + 1)<<" "<<(I + 1);
			cout.flush();
			cin>>sec;

			if (fir > sec)
				ans[I] = fir;
			else
				ans[J] = sec;

			count++;
		}

		for (int i = 0; i < n; i++)
		{
			if (ans[i] == -1)
				ans[i] = n;
		}

		cout<<"! ";
		for (int i = 0; i < n; i++)
		{
			cout<<ans[i]<<" ";
			exit(0);
		}
	}

	return 0;
}