#include <stdio.h>

#define N 250

int parent(int);
int left(int);
int right(int);

int main(){

  int heap[N],i,j,n;

  scanf("%d",&n);

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

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

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

}

  return 0;
} 