#include <stdio.h>
//#include <stdlib.h>
//#include <math.h>

struct Node_struct{
  int p;
  int l;
  int r;
  long int key;
};
typedef struct Node_struct Node;
Node T[500];

int main(){
  int n,i,c;
  long int a[500];
  for(i=0;i<500;i++)
    a[i] = 0;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%ld",&a[i]);

  for(i=0;i<n;i++){
    printf("node %d: key = %ld, ",i+1 ,a[i]);
    if((i+1)/2>=1){
      c = (i+1)/2;
      printf("parent key = %ld, ",a[c-1]);
    }
    c = (i+1) * 2;
    if(a[c-1]!=0){
      printf("left key = %ld, ",a[c-1]);
    }
    c = (i+1) * 2 + 1;
    if(a[c-1] !=0)printf("right key = %ld, ",a[c-1]);
    printf("\n");
  }
  
  return 0;
}

