#include <stdio.h>
#define MAX 10000

int parent(int i){
  return (i/2);
  
}
int left(int i){
  return 2*i;
}
int right(int i){
  return (2*i+1);
}

int main(){
  int n,i,A[MAX+1];
  int r,l,p;
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1){
      p=parent(i);
      printf("parent key = %d, ",A[p]);
    }
    if(left(i)<=n){
      l=left(i);
      printf("left key = %d, ",A[l]);
    }
    if(right(i)<=n){
      r=right(i);
      printf("right key = %d, ",A[r]);
    }
      printf("\n");
  }
  return 0;
}

