#include #include #include #include #include using namespace std;bool vis[100];int n,a[100];int read(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-')f=-1; ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();} return x*f;}void dfs(int now){ if(now==n+1) { for(int i=1;i<=n;i++) printf("%d ",a[i]); printf("\n"); return ; } for(int i=1;i<=n;i++) if(!vis[i]) { vis[i]=true; a[now]=i; dfs(now+1); vis[i]=false; } return ; }int main(){ n=read(); dfs(1); return 0;}