#include<stdio.h>
#define MAX 250
int A[MAX],n;
int left(int i){ return 2*i;}
int right(int i){ return 2*i+1;}
int parent(int i){ return i/2;}

void print(int u){
  printf("node %d: key = %d, ",u,A[u]);
  if(u>1) printf("parent key = %d, ",A[parent(u)]);
  if(left(u)<=n) printf("left key = %d, ",A[left(u)]);
  if(right(u)<=n) printf("right key = %d, ",A[right(u)]);
  printf("\n");
}
int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<=n;i++) print(i);

  return 0;
}


