#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
int n,p[5001],tmp[5001];
int query(int a,int b,int c)
{
cout<<"? "<<a<<" "<<b<<" "<<c<<endl;
int t;
cin>>t;
return t;
}
void solve(int l,int r){
if (l>=r) return;
int x=rnd()%(r-l+1)+l,top=l-1,tt=r+1;
for (int i=l;i<=r;++i) tmp[i]=p[i];
for (int i=l;i<=r;++i) if (i!=x && query(1,tmp[x],tmp[i])==-1) p[++top]=tmp[i];
else if (i!=x) p[--tt]=tmp[i];
p[++top]=tmp[x];
solve(l,top-1),solve(top+1,r);
}
int main()
{
cin>>n;
for (int i=1;i<n;++i) p[i]=i+1;
solve(1,n-1);
int top=0;
for (int i=1;i<n;++i){
while (top>1 && query(tmp[top-1],tmp[top],p[i])==-1) --top;
tmp[++top]=p[i];
}
tmp[++top]=1;
int lt=1;
while (lt+2<top){
if (query(tmp[top-1],tmp[top],tmp[lt])==-1) --top;
else if (query(tmp[top],tmp[lt],tmp[lt+1])==-1) ++lt;
else break;
}
vector<int> ans;
cout<<"! ";
for (int i=lt;i<=top;++i) cout<<tmp[i]<<" ";
cout<<endl;
return ans;
}
//int main(){
//return 0;
//}