#include <bits/stdc++.h>
using namespace std;
int n, mn[16], mx[16], in[16], used = 0;
long long memo[(1 << 16)];
long long solve(int mask, int pos = 0) {
  long long &ret = memo[mask];
  if (ret == -1) {
    while (used & (1 << pos)) ++pos;
    ret = 0;
    for (int i = 0; i < n; ++i)
      if ((mask & (1 << i)) == 0 && (mask & in[i]) == in[i] && pos >= mn[i] &&
          pos <= mx[i])
        ret = min(1000000000000000000LL, ret + solve(mask | (1 << i), pos + 1));
  }
  return ret;
}
int main() {
  int m;
  long long y;
  scanf("%d %I64d %d", &n, &y, &m);
  y -= 2001;
  int a[m], b[m];
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &a[i], &b[i]);
    --a[i];
    --b[i];
    in[b[i]] |= (1 << a[i]);
  }
  bool ok = true;
  int done = 0;
  int ans[n];
  for (int i = 0; i < n; ++i) {
    bool found = false;
    for (int j = 0; j < n; ++j) {
      if ((used & (1 << j)) == 0) {
        memset(memo, -1, sizeof memo);
        memo[(1 << n) - 1] = 1;
        ans[i] = j;
        for (int k = 0; k < n; ++k) {
          if (k <= i)
            mn[k] = mx[k] = ans[k];
          else
            mn[k] = 0, mx[k] = n - 1;
        }
        for (int k = 0; k <= i; ++k) {
          for (int x = 0; x < m; ++x) {
            if (a[x] == k) mn[b[x]] = max(mn[b[x]], ans[k] + 1);
            if (b[x] == k) mx[a[x]] = min(mx[a[x]], ans[k] - 1);
          }
        }
        bool check = true;
        for (int k = 0; k < n; ++k)
          if (mx[k] < mn[k]) check = false;
        long long cont = check ? solve(done) : 0;
        if (y < cont) {
          found = true;
          used |= (1 << j);
          break;
        } else
          y -= cont;
      }
    }
    done |= (1 << i);
    if (!found) {
      ok = false;
      break;
    }
  }
  if (!ok)
    puts("The times have changed");
  else {
    for (int i = 0; i < n; ++i) printf("%d ", ans[i] + 1);
  }
  return 0;
}
