#include <bits/stdc++.h>
using namespace std;
int n, m, data[105][2], ans[16], used, mi[16], ma[16], in[16];
long long k, dp[1 << 16];
long long solve(int sta, int pos) {
  if (dp[sta] != -1) return dp[sta];
  long long ret = 0;
  while (used & (1 << pos)) pos++;
  for (int i = 0; i < n; i++)
    if ((sta & (1 << i)) == 0 && (sta & in[i]) == in[i] && mi[i] <= pos &&
        ma[i] >= pos) {
      ret += solve(sta | (1 << i), pos + 1);
    }
  dp[sta] = ret;
  return ret;
}
int main() {
  cin >> n >> k >> m;
  k -= 2000;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &data[i][0], &data[i][1]);
    data[i][0]--;
    data[i][1]--;
    in[data[i][1]] |= 1 << data[i][0];
  }
  for (int i = 0; i < n; i++) mi[i] = 0, ma[i] = n - 1;
  for (int i = 0; i < n; i++) {
    bool flag = false;
    for (int j = 0; j < n; j++) {
      if (used & (1 << j)) continue;
      ans[i] = j;
      int gg[16], hh[16];
      memcpy(gg, mi, sizeof(gg));
      memcpy(hh, ma, sizeof(hh));
      used |= 1 << j;
      for (int t = 0; t < m; t++) {
        if (data[t][0] == i) mi[data[t][1]] = max(j + 1, mi[data[t][1]]);
        if (data[t][1] == i) ma[data[t][0]] = min(j - 1, ma[data[t][0]]);
      }
      memset(dp, -1, sizeof(dp));
      dp[(1 << n) - 1] = 1;
      solve((1 << (i + 1)) - 1, 0);
      if (dp[(1 << (i + 1)) - 1] >= k) {
        flag = true;
        break;
      }
      k -= dp[(1 << (i + 1)) - 1];
      used ^= 1 << j;
      memcpy(mi, gg, sizeof(gg));
      memcpy(ma, hh, sizeof(hh));
    }
    if (!flag) {
      printf("The times have changed\n");
      return 0;
    }
  }
  for (int i = 0; i < n; i++)
    printf("%d%c", 1 + ans[i], i == n - 1 ? '\n' : ' ');
  return 0;
}
