#include<stdio.h>
#define H_MAX 250

int A[H_MAX];

int main(){
  int H;
  int i;

  scanf("%d", &H);

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

  for(i=1; i<H+1; i++){
    printf("node %d: key = %d, ", i, A[i]);

    if(i==1){
      printf("left key = %d, right key = %d,\n", A[i*2], A[i*2+1]);
      continue;
    }
    printf("parent key = %d, ", A[i/2]);

    if(i*2 == H)
      printf("left key = %d, ", A[i*2]);

    if(i*2 < H){
      printf("left key = %d, right key = %d, \n", A[i*2], A[i*2+1]);
    }
    else
      printf("\n");
  }
  
  return 0;
}