#include<stdio.h>
#define N 250

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

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

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

main(){
  int i,n,a[N],b;

  scanf("%d",&b);
  for(i=1;i<=b;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<=b;i++){
    printf("noe %d: key = %d, ",i,a[i]);
    if(parent(i)>=1){
      printf("parent key = %d, ",a[parent(i)]);
    }
    if(left(i)<=b){
      printf("left key = %d, ",a[left(i)]);
    }
    if(right(i)<=b)
      printf("right key = %d, ",a[right(i)]);
    printf("\n");
  }
  return 0;
}