include [HTML_REMOVED]
using namespace std;
int a[10];
int n;
bool vis[10];
void dfs(int x)
{
if(x == n + 1)
{
for(int i = 1 ; i <= n; i)
{
cout << a[i] << ‘ ‘;
}
cout << endl;
}
for(int i = 1 ; i <= n ; i)
{
if(!vis[i])
{
a[x] = i;
vis[i] = true;
dfs(x + 1);
vis[i] = false;
}
}
}
int main()
{
cin >> n;
dfs(1);
return 0;
}