#include<stdio.h>
#define MAX 100000
int par(int);
int lef(int);
int rig(int);

int par(int i){
  int a;
  a=i/2;
  return a;
}
int lef(int i){
  int a;
  a=2*i;
  return a;
}
int rig(int i){
  int a;
  a=2*i+1;
  return a;
}

int main()
{
  int H,i,A[MAX+1];

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