#include <stdio.h>


int main() {

    int i, t;
    int n;
    int A[100001];

    scanf("%d",&n);

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

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

