#include <stdio.h>
#include <stdlib.h>

#define HMAX 250
#define kMAX 2000000000
 
 int main() {
   int H, k[HMAX], i;

   scanf("%d", &H);
   if(HMAX<H) exit(8);
   for(i=1; i<=H; i++) {
     scanf("%d", &k[i]);
     if(k[i]<(-1)*kMAX||kMAX<k[i]) exit(8);
   }

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

