#include <bits/stdc++.h>
int main(void) {
  int input[4][13], i, n, mark, card, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &mark, &card);
    input[mark][card] = 1;
  }
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 13; j++) {
      if (input[i][j] == 0) {
        printf("%d %d", i, j);
      }
    }
  }
}
