#include <stdio.h>

int parent(int i){ return i / 2;}
int left(int i){ return 2 * i;}
int right(int i){ return 2 * i + 1;}

int main(){
  int h[512], size, n, i;

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

  for(i = 1; i <= size; ++i){
    printf("node %d: key = %d, ", i, h[i]);
    if(parent(i)) printf("parent key = %d, ", h[parent(i)]);
    if(left(i) <= size) printf("left key = %d, ", h[left(i)]);
    if(right(i) <= size) printf("right key = %d, ", h[right(i)]);
    puts("");
  }
  return 0;
}