#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long b, long long p) {
  long long res = 1;
  a %= p;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % p;
    a = a * a % p;
  }
  return res;
}
template <typename T>
T gcd(T x, T y) {
  while (y) {
    T t = x % y;
    x = y;
    y = t;
  }
  return x;
}
template <typename T>
T lsM(T x, T y) {
  return x / gcd(x, y) * y;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
long long dp[17][(1 << 16) + 10];
int at[155], val[155], n, before[155];
long long fuck(int p) {
  memset(at, -1, sizeof val);
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int i = 0; i < p; i++) at[val[i]] = i;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < (1 << n); j++)
      if (dp[i][j] != 0) {
        for (int k = 0; k < n; k++)
          if (~j >> k & 1) {
            if (at[i] != -1 && at[i] != k) continue;
            if ((j & before[k]) == before[k])
              dp[i + 1][j ^ (1 << k)] += dp[i][j];
          }
      }
  return dp[n][(1 << n) - 1];
}
int main() {
  int m;
  long long y;
  scanf("%d%lld%d", &n, &y, &m);
  y -= 2001;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--, v--;
    before[v] |= 1 << u;
  }
  if (fuck(0) <= y) {
    puts("The times have changed");
    return 0;
  }
  int mask = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (mask >> j & 1) continue;
      val[i] = j;
      long long tmp = fuck(i + 1);
      if (tmp <= y)
        y -= tmp;
      else {
        mask |= 1 << j;
        break;
      }
    }
  for (int i = 0; i < n; i++) printf("%d ", val[i] + 1);
  puts("");
  return 0;
}
