#include <stdio.h>

int main(){
  int n,i;
  long long A[251];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%lld",&A[i]);
  }

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