#include<stdio.h>
#define MAX 250
#define MIN -2147483648
struct node{
  int key,parent,left,right;
};
struct node A[MAX*2+2];
int parent(int);
int left(int);
int right(int);

int main(){
  int i,n;
  for(i=0;i<=MAX*2+1;i++){
    A[i].key=MIN;
      }
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i].key);
  }
  for(i=1;i<=n;i++){
    A[i].parent = parent(i);
    A[i].left = left(i);
    A[i].right = right(i);
  }
  for(i=1;i<=n;i++){
    printf("node %d: ",i);
    printf("key = %d, ",A[i].key);
    if(i!=1) printf("parent key = %d, ",A[i].parent);
    if(A[i].left!=MIN) printf("left key = %d, ",A[i].left);
    if(A[i].right!=MIN) printf("right key = %d, ",A[i].right);
    printf("\n");
  }
  
  return 0;
}
int parent(int i){
  return A[i/2].key;
}
int left(int i){
  return A[2*i].key;
}
int right(int i){
  return A[2*i+1].key;
}

