#include <stdio.h>

#define INF -2000000001

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

  scanf("%d",&n);
  for(i=0;i<502;i++) A[i]=INF;

  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(A[i/2]!=INF) printf("parent key = %d, ",A[i/2]);
    if(A[2*i]!=INF) printf("left key = %d, ",A[2*i]);
    if(A[2*i+1]!=INF) printf("right key = %d, ",A[2*i+1]);

    printf("\n");
  }

  return 0;
}

