
#include <stdio.h>
#define MAX 251


int main(){
  int H[MAX + 1], i, h;
  
  scanf("%d", &h); 

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

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

  return 0;
}