#include <stdio.h>
#define MAX 251

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

int main(){
  int i,n,heap[MAX];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&heap[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,heap[i]);
    if(i>1)
    printf("parent key = %d, ",heap[parent(i)]);
    int l=left(i);
    int r=right(i);
    if(l<=n)
    printf("left key = %d, ",heap[l]);
    if(r<=n)
    printf("right key = %d, ",heap[r]);
    printf("\n");
  }
  return 0;
}