#include<stdio.h>
#include<stdlib.h>
int parent(int);
int left(int);
int right(int);
int main(){
  int *T, n, i;
  scanf("%d",&n);
  T = (int*)malloc(sizeof(int) * (n+1));
  for(i=1; i<=n; i++) scanf("%d",&T[i]);
  for(i=1; i<=n; i++){
    printf("node %d: ",i);
    printf("key = %d, ",T[i]);
    if(i != 0) printf("parent key = %d, ",T[parent(i)]);
    if(left(i) <= n) printf("left key = %d, ",T[left(i)]);
    if(right(i) <= n) printf("right key = %d, ",T[right(i)]);
    printf("\n");
  }
  return 0;
}
int parent(int n){
  return n/2;
}
int left(int n){
  return 2*n;
}
int right(int n){
  return 2*n+1;
}