#include<stdio.h>
#define NIL -200000

int main(){

  int sumnode;
  int i,parent,left,right;
  int heap[400];

  for(i = 0; i < 400; i++){

    heap[i] = NIL;

  }

  scanf("%d",&sumnode);

  for(i =1; i<= sumnode; i++){

    scanf("%d",&heap[i]);

  }

  for(i = 1; i <= sumnode; i++){

    parent = i /2;
    left = i * 2;
    right = i * 2 + 1;

    printf("node %d: key = %d, ",i,heap[i]);
    

    if(parent != 0){

      printf("parent key = %d, ",heap[parent]);

    }

    if(heap[left] != NIL){

      printf("left key = %d, ",heap[left]);

    }

    if(heap[right] != NIL){

      printf("right key = %d, ",heap[right]);

    }

    printf("\n");

  }

  return 0;

}