#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
int n, p[10], hashtable[10] = { 0 };
using namespace std;
void digui(int index)
{
if (index == n + 1)
{
for (int i = 1; i <=n; i++)
{
cout << p[i];
}
cout << endl;
return;
}
for (int x = 1; x <= n; x++)
{
if (hashtable[x] == false)
{
p[index] = x;
hashtable[x] = true;
digui(index + 1);
hashtable[x] = false;
}
}
}
int main()
{
n = 4;
digui(1);
return 0;
}