#include <bits/stdc++.h>
using namespace std;
const long long inv = numeric_limits<long long>::max() - 10ll;
const int max_n = 21;
const int max_p2n = 65546;
int n;
long long y;
int m;
vector<int> inadjl[max_n];
int used;
int f[max_n];
int res[max_n];
long long dp[max_p2n];
void place(int k, int i) {
  for (int j = 0; j < inadjl[i].size(); ++j) {
    int pi = inadjl[i][j];
    if ((k >> pi) % 2 == 0) return;
  }
  if (inv - dp[k] < dp[k - (1 << i)])
    dp[k] = inv;
  else
    dp[k] += dp[k - (1 << i)];
  return;
}
long long currct;
bool enough() {
  dp[0] = 1ll;
  for (int k = 1; k < (1 << n); ++k) {
    int nk = 0;
    for (int i = 0; i < n; ++i) nk += (k >> i) % 2;
    dp[k] = 0ll;
    if (f[nk - 1] != (-1)) {
      if ((k >> f[nk - 1]) % 2) {
        place(k, f[nk - 1]);
      } else
        continue;
    } else {
      for (int i = 0; i < n; ++i)
        if ((k >> i) % 2) place(k, i);
    }
  }
  currct = dp[(1 << n) - 1];
  return (currct >= y);
}
int main() {
  scanf("%d", &n);
  cin >> y;
  scanf("%d", &m);
  y -= 2000ll;
  int u, v;
  for (int i = 0; i < m; ++i) {
    scanf("%d", &u);
    scanf("%d", &v);
    --u;
    --v;
    inadjl[v].push_back(u);
  }
  fill(f, f + n, -1);
  if (not enough()) {
    printf("The times have changed\n");
    return 0;
  }
  used = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j)
      if ((used >> j) % 2 == 0) {
        f[j] = i;
        used += (1 << j);
        if (enough())
          break;
        else {
          f[j] = -1;
          used -= (1 << j);
          y -= currct;
        }
      }
  }
  for (int i = 0; i < n; ++i) res[f[i]] = i;
  for (int i = 0; i < n; ++i) printf("%d ", res[i] + 1);
  printf("\n");
  return 0;
}
