#include<stdio.h>
#define MAX 100000

int oya (int i) {return i / 2;}
int hidari(int i) {return 2 * i;}
int migi (int i) {return 2 * i +1;}

int main(void){
  int n, i, J[MAX+1];

  scanf("%d", &n);
  for(i = 1; i <= n; i++) scanf("%d", &J[i]);

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



