#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define rad M_PI/3
#define N 500001
#define Max 10000
#define NTL -1
int n;
int heap[Max];
int main(){
  int i,parent,left,right;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&heap[i]);
  }
  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i+1, heap[i]);
    parent = (i-1)/2;
    left = i*2+1;
    right = i*2+2;
    if(i!=0) printf("parent key = %d, ",heap[parent]);
    if(left<n)printf("left key = %d, ",heap[left]);
    if(right < n) printf("right key = %d, ", heap[right]);
    printf("\n");
  }
  return 0;
}
