#include <stdio.h>

#define H 250

void print(int);

int A[H],h;

int main(){

  int i;

  scanf("%d",&h);

  for(i=1; i<=h ; i++){
    scanf("%d",&A[i]);
  }

  for(i=1; i<=h ; i++){
    print(i);
  }

  return 0;

}


void print(int k){


  printf("node %d: key = %d, ",k,A[k]);

  if(k/2 >= 1) printf("parent key = %d, ",A[k/2]);
  if(k*2 <= h) printf("left key = %d, ",A[k*2]);
  if(k*2+1 <= h) printf("right key = %d, ",A[k*2+1]);

  printf("\n");
}