#include<stdio.h>

int main(){
  int A[250],i,j,n;
  int pkey=0,lkey=0,rkey=0;

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

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

