#include <stdio.h>
#include <stdlib.h>
#define NIL NULL
#define KMAX 100000
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 n,l,r,root;
int i,j;
int Key[KMAX+1];

  scanf("%d",&n);

  for(i=1;i<=n;i++) {
    scanf("%d",&Key[i]);
}
  for(i=1;i<=n;i++) {
    printf("node %d: key = %d,",i,Key[i]);
    if(parent(i)>=1) printf("parent key = %d,",Key[parent(i)]);
    if(left(i)<=n) printf("left key = %d,",Key[left(i)]);
    if(right(i)<=n) printf("right key = %d,",Key[right(i)]);
    printf("\n");
  }
  return 0;
}
