#include<stdio.h>

#define MAX 250
#define NIL -2000000000

int key[MAX];
int p(int c);
int r(int c);
int l(int c);

int main(){
  int i,n,h;
  scanf("%d",&n);
  for(i=0;i<MAX;i++){
    key[i]=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d",&h);
    key[i]=h;
  }
  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i+1,key[i]);
    if(key[p(i)]!=NIL&&i!=0){
      printf("parent key = %d, ",key[p(i)]);
    }
    if(MAX>l(i)&&key[l(i)]!=NIL){
      printf("left key = %d, ",key[l(i)]);
    }
    if(MAX>r(i)&&key[r(i)]!=NIL){
      printf("right key = %d, ",key[r(i)]);
    }
    printf("\n");
  }
  return 0;
}

int p(int c){
  return (c-1)/2;
}

int r(int c){
  return 2*c+2;
}

int l(int c){
  return 2*c+1;
}

