#include<stdio.h>

int p[1030];
int main(){
  int a;
  scanf("%d",&a);
  for(int i = 1;i<=a;i++)scanf("%d",p+i);
  for(int i = 1;i<=a;i++){
    printf("node %d: key = %d, ",i,p[i]);
    if(i!=1)printf("parent key = %d, ",p[i/2]);
    if(i*2<=a)printf("left key = %d, ",p[2*i]);
    if(i*2+1<=a)printf("right key = %d, ",p[2*i+1]);
    puts("");
	}
}

