using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace ConsoleApplication {
public class Program {
private const int n = 3;
private static int[] b = new int[n];
private static bool[] u = new bool[n];
public static void Main(string[] args) {
generate(0);
}
private static void print() {
for (int j = 0; j < n; j++) {
Console.Write(b[j] + " ");
}
Console.WriteLine();
}
private static void generate(int i) {
if (i == n) {
print();
return;
}
for (int j = 0; j < n; j++) {
if (!u[j]) {
b[i] = j;
u[j] = true;
generate(i + 1);
u[j] = false;
}
}
}
}
}