include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
const int N = 100;
int q1[N];
int q2[N];
int n;
int u = 1;
void output(int a)
{
if (a > n)
return;
for (int i = 1; i <= n; i)
{
if (q2[i] == 0)
{
q1[a] = i;
q2[i] = 1;
output(a + 1);
q2[i] = 0;
}
}
if (a == n)
{
for (int i = 1; i <= n; i)
cout << q1[i];
cout << endl;
}
}
int main(void)
{
cin >> n;
for (int i = 1; i <= n; i++)
q2[i] = 0;
output(1);
}