//tourney.cpp
//pgmr: T Feil
//Knockout Tournament problem for 2002 EC ACM regionals

#include <iostream.h>
#include <math.h>

int size, T[512], Best[260], Worst[260], BestWin[260];

void FindBest(int i,   int b){
  int Lchild, Rchild;

  if(i>(size-2)) return;  //@leaf

  Lchild = 2*i+1;
  Rchild = Lchild+1;

  if(T[Lchild]==T[i]){
    Best[T[Rchild]]=b+1;
    FindBest(Lchild,b);
    FindBest(Rchild,b+1);
  }
  else{  //T[Rchild]==T[i]
    Best[T[Lchild]]=b+1;
    FindBest(Rchild,b);
    FindBest(Lchild,b+1);
  }
} 
  
void main(){
  int n,i,s,a;
  int notfirst =0;

  cin>>n;
  while(n>0){
    size=(int)pow(2,n);
    //get tourney results
    s=size/2;
    while(s>0){
      for(i=0;i<s;i++)
        cin>>T[s-1+i];
      s /= 2;
    }
    //fill in leaves
    for(i=1;i<=size;i++)
      T[size-2+i]=i;

    //compute BestWin
    for(i=1;i<=size;i++) BestWin[i]=0;
    for(i=0;i<size-1;i++)
      BestWin[T[i]]++;
    BestWin[T[0]]=n;

    //calculate Worst
    for(i=1;i<=size;i++)
      Worst[i] = size-((int)pow(2,BestWin[i])-1);

    //calculate Best
    Best[T[0]]=1;
    FindBest(0,1);

    //to throw blank line
    if(notfirst) cout<<endl;
    notfirst=1;

    //get queries
    cin>>n;
    for(i=0;i<n;i++){
      cin>>a;
      cout<<"Player "<<a<<" can be ranked as high as "<<Best[a];
      cout<<" or as low as "<<Worst[a]<<'.'<<endl;
    }

    cin>>n;
  }
  return 0;
}

  
