#include <stdio.h>
#define N 250

int main(){
  int n,i;
  int num[N];

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