#include <stdio.h>
typedef struct {
  int right;
  int left;
  int parent;
  int key;
}Node;

#define NIL NULL

Node root,A[502];

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