#define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #include using namespace std; #define CRP(t, x) const t &x #define OPL(t, x) bool operator<(CRP(t, x)) const #define FIL(x, v) memset(x, v, sizeof(x)) #define CLR(x) FIL(x, 0) #define NE1(x) FIL(x, -1) #define INF(x) FIL(x, 0x3f) typedef long long ll, i64; const int N = 1000; int a[N], n, x, y, cnt; bool b[N]; void dfs(int st) { if (st == n) { for (int i = 0; i < n; i++) printf("%2d%c", a[i], " \n"[i == n - 1]); cnt++; } else { if (st == 0) b[a[st] = x] = true, dfs(st + 1), b[x] = false; else if (st == n - 1) { if (!b[y] && abs(y - a[st - 1]) <= 2) b[a[st] = y] = true, dfs(st + 1), b[y] = false; } else for (int i = 1; i <= n; i++) if (i != x && i != y && !b[i] && abs(i - a[st - 1]) <= 2) b[a[st] = i] = true, dfs(st + 1), b[i] = false; } } int main() { for (; ~scanf("%d%d%d", &n, &x, &y); printf(":%d\n", cnt)) dfs(cnt = 0); return 0; }