#include <bits/stdc++.h>
using namespace std;
int n, m, from[105], to[105], data[105], fix[105], ban[100050], belong[100050];
long long ask, f[20][100050];
bool finished, solved[20][100050];
int Rand() { return (rand() << 15) | rand(); }
void DFS(int current, int sets) {
  int i;
  if (solved[current][sets]) {
    return;
  }
  solved[current][sets] = true;
  if (sets == (1 << n) - 1) {
    f[current][sets] = 1;
  }
  if (fix[current] != -1) {
    if (((1 << fix[current]) & sets) == 0 &&
        ((1 << fix[current]) & ban[sets]) == 0) {
      DFS(current + 1, sets | (1 << fix[current]));
      f[current][sets] = f[current + 1][sets | (1 << fix[current])];
    } else {
      f[current][sets] = 0;
    }
    return;
  }
  for (i = 0; i < n; i++)
    if (((1 << i) & sets) == 0 && ((1 << i) & ban[sets]) == 0) {
      DFS(current + 1, sets | (1 << i));
      f[current][sets] += f[current + 1][sets | (1 << i)];
    }
  return;
}
void Solve(int current) {
  int i;
  if (finished) {
    return;
  }
  if (current > n) {
    for (i = 1; i <= n; i++) {
      printf("%d ", data[i] + 1);
    }
    printf("\n");
    finished = true;
    return;
  }
  for (i = 0; i < n; i++)
    if (fix[i] == -1) {
      fix[i] = current - 1;
      memset(solved, false, sizeof(solved));
      memset(f, 0, sizeof(f));
      DFS(0, 0);
      if (f[0][0] >= ask) {
        data[current] = i;
        Solve(current + 1);
        break;
      }
      ask -= f[0][0];
      fix[i] = -1;
    }
  return;
}
int main() {
  int i, j;
  srand((unsigned)time(0));
  scanf("%d%I64d%d", &n, &ask, &m);
  ask -= 2000;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &from[i], &to[i]);
    from[i]--;
    to[i]--;
  }
  for (i = 0; i < 1 << n; i++) {
    for (j = 1; j <= m; j++)
      if ((1 << to[j]) & i) {
        ban[i] |= 1 << from[j];
      }
  }
  memset(fix, -1, sizeof(fix));
  Solve(1);
  if (!finished) {
    printf("The times have changed\n");
  }
  return 0;
}
