#include<stdio.h>
#define N 250
typedef struct{
  int key;
}node;
int main(){
  int n,i;
  node H[N];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&H[i].key);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,H[i].key);
    if(i!=1) printf("parent kay = %d, ",H[i/2].key);
    if(n>=(2*i)) printf("left key = %d, ",H[2*i].key);
    if(n>=(2*i+1)) printf("right key = %d, ",H[2*i+1].key);
    printf("\n");
  }
  return 0;
}