#include <stdio.h>
#include <stdlib.h>

#define MAX_N 7
#define MAX_N2 (1<<MAX_N)

int main(void)
{
  int level[MAX_N2+1];
  char beats[MAX_N2+1][MAX_N2+1];
  int n, n2, m, i, j, k, t, beat_num, beat_by_num;
  int first = 1;

  while (scanf("%d", &n) == 1 && n) {
    if (!first) {
      printf("\n");
    }
    first = 0;
    n2 = (1 << n);
    for (i = 1; i <= n2; i++) {
      for (j = 1; j <= n2; j++) {
	beats[i][j] = 0;
      }
      level[i] = i;
    }
    
    while (--n >= 0) {
      for (i = 1; i <= (1 << n); i++) {
	scanf("%d", &t);
	if (t != level[2*i-1]) {
	  beats[t][level[2*i-1]] = 1;
	}
	if (t != level[2*i]) {
	  beats[t][level[2*i]] = 1;
	}
	level[i] = t;
      }
    }

    for (k = 1; k <= n2; k++) {
      for (i = 1; i <= n2; i++) {
	for (j = 1; j <= n2; j++) {
	  beats[i][j] |= beats[i][k] && beats[k][j];
	}
      }
    }

    scanf("%d", &m);
    for (i = 0; i < m; i++) {
      scanf("%d", &k);
      beat_num = beat_by_num = 0;
      for (j = 1; j <= n2; j++) {
	if (beats[k][j]) {
	  beat_num++;
	}
	if (beats[j][k]) {
	  beat_by_num++;
	}
      }
      printf("Player %d can be ranked as high as %d or as low as %d.\n",
	     k, beat_by_num+1, n2-beat_num);
    }
  }
  return 0;

}
