/* solution to knockout tournament by bob roos */

#include <stdio.h>

int n,N,k;
int a[32769];
int p[32769];

void process(int i)
{
  int pos = N+i-1;
  int sum = N;
  int pow = 1;
  int count = 0;
  int temp = i;

  while (pos/2 > 0)
  {
    if (a[pos/2] != temp)
    {
      count++;
      temp = a[pos/2];
    }
    if (a[pos/2] == i)
      sum = sum - pow;
    pow = 2*pow;
    pos = pos/2;
  }

  printf("Player %d can be ranked as high as %d or as low as %d.\n",i,count+1,sum);
  
}

int main(void)
{
  int i,temp;
  int first=1;

  while(scanf("%d",&n) && n > 0)
  {
   if(first) first=0; else printf("\n");
    N = 1 << n;
    temp= N/2;
    while (temp > 0)
    {
      for (i = temp; i <= 2*temp-1; i++)
        scanf("%d",&a[i]);
      temp = temp/2;
    }
    scanf("%d",&k);
    for (i = 0; i < k; i++)
    {
      scanf("%d",&p[i]);
      process(p[i]);
    }
  }
  return 0;
}

