#include <stdio.h>
#define MAX 10000
int parent(int i){
  return i/2;
}
int left(int i){
  return i*2;
}
int right(int i){
  return i*2+1;
}
int main(){
  int A[MAX+1];
  int H,k;
  scanf("%d",&H);
  for(k=1;k<=H;k++){
    scanf("%d",&A[k]);
  }
  for(k=1;k<=H;k++){
    printf("node %d; key = %d, ",k,A[k]);
    if(parent(k)>=1)printf("parent key = %d, ",A[parent(k)]);
    if(parent(k)<=H)printf("left key = %d, ",A[left(k)]);
    if(parent(k)<=H)printf("right key = %d, ",A[right(k)]);
    printf("\n");
           }
      return 0;
  }

