#include <stdio.h>
#define H 251

typedef struct{
  int k;
  int l;
  int r;
  int p; 
}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].k);
  }
   for(i=1;i<=n;i++){
     if(i/2>=1)A[i].p=A[i/2].k;
    if(left(i)<=n)A[i].l=A[left(i)].k;
    if(right(i)<=n)A[i].r=A[right(i)].k;
    printf("node %d: key = %d, ",i,A[i].k);

    if(A[i].p)
     printf("parent key = %d, ",A[i].p);
    if(A[i].l)
      printf("left key = %d, ",A[i].l);
    if(A[i].r)
      printf("right key = %d, ",A[i].r);

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

