#include <stdio.h>

#define H 250

int main(){
  int Heap[H];
  int n, i;

  scanf("%d", &n);
  for(i = 1; i <= n; i++)
    scanf("%d", &Heap[i]);

  for(i = 1; i <= n; i++){
    if(i == 1)
      printf("node 1: key = %d, left key = %d, right key = %d, \n"
	 , Heap[i], Heap[i*2], Heap[i*2+1]);

    else if(i*2 <= n && i*2+1 >n)
      printf("node %d: key = %d, parent key = %d, left key = %d \n"
	   , i, Heap[i], Heap[i/2], Heap[i*2]);


    else if(i*2 > n)
      printf("node %d: key = %d, parent key = %d, \n"
	   , i, Heap[i], Heap[i/2]);

    else
      printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d, \n"
	   , i, Heap[i], Heap[i/2], Heap[i*2], Heap[i*2+1]);
  }

  return 0;
}