define _CRT_SECURE_NO_WARNINGS
include [HTML_REMOVED]
int book[1001];
int a[10];
int n;
void dfs(int deep) {
if (deep > n) {
for (int i = 1; i <= n; i) {
if (i < n) {
printf(“%d “, a[i]);
}
else {
printf(“%d\n”, a[i]);
}
}
}
else {
for (int i = 1; i <= n; i) {
if (book[i] == 0) {
a[deep] = i;
book[i] = 1;
dfs(deep + 1);
book[i] = 0;
}
}
}
}
int main() {
scanf(“%d”, &n);
dfs(1);
return 0;
}