#include <stdio.h>
#define SIZE 251

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


