#include<stdio.h>

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

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 i,n,pk,lk,rk;
  int T[250];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&T[i]);
  }

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