#include <bits/stdc++.h>
using namespace std;
const int MAXN = 16;
const int MASKCNT = 1 << MAXN;
int n, m;
long long y;
vector<int> in[MAXN], out[MAXN];
long long dp[MASKCNT + 1];
int ans[MAXN];
bool was[MAXN];
inline void changeBit(int &mask, int b) { mask = mask ^ (1 << b); }
inline int getBit(int mask, int b) { return mask & (1 << b); }
long long permCnt(int mask, int st = 0) {
  if (st == n) return 1;
  if (was[st]) return permCnt(mask, st + 1);
  if (dp[mask] != -1) return dp[mask];
  dp[mask] = 0;
  for (int i = 0; i < n; i++)
    if (ans[i] == -1) {
      bool flag = true;
      for (size_t k = 0; k < in[i].size(); k++)
        if (ans[in[i][k]] != -1 && ans[in[i][k]] > st) {
          flag = false;
          break;
        }
      if (flag)
        for (size_t k = 0; k < out[i].size(); k++)
          if (ans[out[i][k]] != -1 && ans[out[i][k]] < st) {
            flag = false;
            break;
          }
      if (flag) {
        was[st] = true;
        ans[i] = st;
        changeBit(mask, i);
        long long tmp = permCnt(mask, st + 1);
        ans[i] = -1;
        changeBit(mask, i);
        was[st] = false;
        dp[mask] += tmp;
      }
    }
  return dp[mask];
}
int main() {
  cin >> n >> y >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    in[b].push_back(a);
    out[a].push_back(b);
  }
  y -= 2000;
  memset(ans, -1, sizeof(ans));
  memset(dp, -1, sizeof(dp));
  long long tt = permCnt((1 << n) - 1);
  if (tt < y) {
    cout << "The times have changed\n";
    return 0;
  }
  int currMask = (1 << n) - 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      if (!was[j]) {
        was[j] = true;
        ans[i] = j;
        changeBit(currMask, j);
        memset(dp, -1, sizeof(dp));
        long long tmp = permCnt(currMask);
        if (tmp >= y) break;
        y -= tmp;
        was[j] = false;
        ans[i] = -1;
        changeBit(currMask, j);
      }
  }
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << ans[i] + 1;
  }
  cout << endl;
}
