#include <bits/stdc++.h>
using namespace std;
long long y;
int n, m, a, b;
vector<int> senior[16], junior[16];
long long perm[1 << 16];
int prof[16];
int profsorted[16];
long long years(int seated) {
  for (int i = 0; i < seated; ++i) {
    for (int j = 0; j < senior[i].size(); ++j) {
      int s = senior[i][j];
      if (s < seated && prof[s] > prof[i]) return 0;
    }
    profsorted[i] = prof[i];
  }
  sort(profsorted, profsorted + seated);
  perm[0] = 1;
  for (int i = (1 << seated); i < (1 << n); i += (1 << seated)) {
    int newbie = -1;
    for (int j = 0; j < n; ++j)
      if (i & (1 << j)) newbie++;
    for (int j = 0; j < seated; ++j)
      if (profsorted[j] <= newbie) newbie++;
    perm[i] = 0;
    for (int newseat = 0; newseat < n; ++newseat)
      if (i & (1 << newseat)) {
        bool valid = true;
        for (int j = 0; j < senior[newseat].size(); ++j) {
          int s = senior[newseat][j];
          if (s < seated && prof[s] > newbie) valid = false;
        }
        for (int j = 0; j < junior[newseat].size(); ++j) {
          int s = junior[newseat][j];
          if (s < seated && prof[s] < newbie) valid = false;
          if (i & (1 << s)) valid = false;
        }
        if (valid) perm[i] += perm[i ^ (1 << newseat)];
      }
  }
  return perm[(1 << n) - (1 << seated)];
}
int main() {
  cin >> n >> y >> m;
  y -= 2001;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    a--;
    b--;
    senior[b].push_back(a);
    junior[a].push_back(b);
  }
  if (years(0) <= y) {
    cout << "The times have changed" << endl;
    return 0;
  }
  int profmask = (1 << n) - 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j)
      if (profmask & (1 << j)) {
        prof[i] = j;
        long long y2 = years(i + 1);
        if (y >= y2)
          y -= y2;
        else {
          if (i > 0) cout << ' ';
          cout << (j + 1);
          profmask ^= 1 << j;
          break;
        }
      }
  }
  cout << endl;
}
