#include <stdio.h>
#define H 251

typedef struct{
  int b;
  int c;
  int d;
  int e; 
}n;



n a[H];



int left(int i){return 2*i;}
int right(int i){return 2*i+1;}





int main(){
  int n,i;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i].b);
  }
   for(i=1;i<=n;i++){
     if(i/2>=1)a[i].e=a[i/2].b;
    if(left(i)<=n)a[i].c=a[left(i)].b;
    if(right(i)<=n)a[i].d=a[right(i)].b;
    printf("node %d: key = %d, ",i,a[i].b);

    if(a[i].e)
     printf("parent key = %d, ",a[i].e);
    if(a[i].c)
      printf("left key = %d, ",a[i].c);
    if(a[i].d)
      printf("right key = %d, ",a[i].d);

    printf("\n");
   }
   
  
  return 0;
}

