#include <bits/stdc++.h>
using namespace std;
long long dp[(1 << 18) + 3];
int ans[18];
int flag[18];
int pre[20];
int main() {
  int n, m;
  long long y;
  scanf("%d%lld%d", &n, &y, &m);
  int a, b;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a, &b);
    pre[b] |= 1 << (a - 1);
  }
  y -= 2001;
  for (int i = 1; i <= n; i++) {
    for (ans[i] = 1;; ans[i]++) {
      if (!flag[ans[i]]) {
        if (ans[i] > n) {
          printf("The times have changed");
          return 0;
        }
        memset(dp, 0, sizeof(dp));
        dp[0] = 1;
        for (int s = 0; s < (1 << n); s++) {
          if (dp[s]) {
            int cnt = __builtin_popcount(s);
            for (int k = 1; k <= n; k++) {
              if (!(s & (1 << (k - 1)))) {
                if ((ans[k] == 0 || ans[k] == cnt + 1) &&
                    ((s & pre[k]) == pre[k])) {
                  dp[s | (1 << (k - 1))] += dp[s];
                }
              }
            }
          }
        }
        if (y >= dp[(1 << n) - 1]) {
          y -= dp[(1 << n) - 1];
        } else {
          flag[ans[i]] = 1;
          break;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
