#include<stdio.h>
#include<stdlib.h>

int p(int i){return i/2;}
int l(int i){return 2*i;}
int r(int i){return 2*i+1;}

int main(){
  int n,i,*A;

  scanf("%d",&n);
  A=(int *)malloc((n+1)*sizeof(int));
  for(i=1;i<=n;i++) scanf("%d",&A[i]);

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

