#include<stdio.h>
int main(){
  int i,n,k,p,l,r;
  scanf("%d",&n);
  int T[n+1];
  for(i=1;i<n+1;i++){
    scanf("%d",&k);
    T[i]=k;
  }
  for(i=1;i<n+1;i++){
    p=i/2;
    l=i*2;
    r=i*2+1;
    printf("node %d: key = %d, ",i,T[i]);
    if(p>0)printf("parent key = %d, ",T[p]);
    if(l<n+1)printf("left key = %d, ",T[l]);
    if(r<n+1)printf("right key = %d, ",T[r]);
    printf("\n");
  }
  return 0;
}

