#include <bits/stdc++.h>
const char Directory[300] =
    "/Users/carlosjosetoribio/NetBeansProjects/Runner/dist/Debug/GNU-MacOSX/"
    "runner";
using namespace std;
int seat[20], N;
int fixe[20];
long long memo[1 << 16][17];
long long cnt(int mask = 0, int id = 0) {
  if (id == N) return 1;
  if (memo[mask][id] != -1) return memo[mask][id];
  for (int i = 0; i < N; ++i)
    if (fixe[i] == id) return memo[mask][id] = cnt(mask, id + 1);
  long long ways = 0;
  for (int i = 0; i < N; ++i) {
    if (mask & seat[i]) {
      bool ok = true;
      for (int k = 0; k < N; ++k)
        if (seat[i] & (1 << k) & mask) {
          if (fixe[k] < id) ok = false;
        }
      if (!ok) continue;
    }
    if (mask & (1 << i)) continue;
    ways += cnt(mask ^ (1 << i), id + 1);
  }
  return memo[mask][id] = ways;
}
int main(int argc, char** argv) {
  if (strcmp(argv[0], Directory) == 0) {
    freopen("in.txt", "r", stdin);
  }
  int M;
  long long Y;
  cin >> N >> Y >> M;
  memset(seat, 0, sizeof(seat));
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    seat[a] |= (1 << b);
  }
  Y -= 2000;
  memset(fixe, -1, sizeof(fixe));
  memset(memo, -1, sizeof(memo));
  long long C = cnt();
  if (C < Y) {
    puts("The times have changed");
  } else {
    int mask = 0;
    for (int i = 0; i < N; ++i) {
      mask ^= (1 << i);
      for (int j = 0; j < N; ++j) {
        bool b = false;
        for (int k = 0; k < i; ++k)
          if (fixe[k] == j) b = true;
        if (b) continue;
        fixe[i] = j;
        memset(memo, -1, sizeof(memo));
        long long t = cnt(mask);
        if (t >= Y)
          break;
        else
          Y -= t;
        fixe[i] = -1;
      }
    }
    for (int i = 0; i < N; ++i)
      if (i < N - 1)
        cout << fixe[i] + 1 << " ";
      else
        cout << fixe[i] + 1 << endl;
  }
  return 0;
}
