#include <bits/stdc++.h>
using namespace std;
const int h = 16;
bool us[h];
int n, m, l[h], res[h];
long long y, d[1 << h];
long long calc() {
  memset(d, 0, sizeof d);
  d[0] = 1;
  for (int u(0), _b(1 << n); u < _b; ++u)
    if (d[u] > 0) {
      int k = 0;
      for (int i(0), _b(n); i < _b; ++i)
        if (u & 1 << i) ++k;
      for (int j(0), _b(n); j < _b; ++j)
        if (~u & 1 << j)
          if ((res[j] == -1 || res[j] == k) && (u & l[j]) == l[j])
            d[u | 1 << j] += d[u];
    }
  return d[(1 << n) - 1];
}
int main() {
  cin >> n >> y >> m;
  y -= 2001;
  int a, b;
  for (int i(0), _b(m); i < _b; ++i) {
    scanf("%d%d", &a, &b);
    l[b - 1] |= 1 << (a - 1);
  }
  memset(res, -1, sizeof res);
  memset(us, 0, sizeof us);
  for (int i(0), _b(n); i < _b; ++i)
    for (int j(0), _b(n + 1); j < _b; ++j)
      if (!us[j]) {
        if (j == n) {
          printf("The times have changed\n");
          return 0;
        }
        res[i] = j;
        long long r = calc();
        if (r > y) {
          us[j] = true;
          break;
        } else
          y -= r;
      }
  for (int i(0), _b(n); i < _b; ++i) printf("%d ", res[i] + 1);
  printf("\n");
  return 0;
}
