#include<stdio.h>
#define MAX 100000
int main(){
  int n, i;
  int M[MAX+1];
  scanf("%d", &n);
  for(i=1;i<n+1;i++)scanf("%d",&M[i]);
  for(i=1;i<n+1;i++){
    printf("node %d: key = %d, ",i,M[i]);
    if(i/2>=1)printf("parent key = %d, ",M[i/2]);
    if(i*2<=n) printf("left key = %d, ",M[i*2]);
    if(i*2+1<=n) printf("right key = %d, ",M[i*2+1]);
    printf("\n");
  }
  
  return 0;
}

