#include <stdio.h>
#define H 250

struct Node{
  int id;
  int k;
  int pk;
  int lk;
  int rk;
};

typedef  struct Node node;
int n;
node s[H];

void heep();

int main()
{
  int i;

  scanf("%d", &n);

  for(i=1;i<=n;i++){
    scanf("%d", &s[i].k);
    s[i].id = i;
  }
  
  heep();

  return 0;
}

void heep()
{
  int i;
  
  for(i=1;i<=n;i++){
    s[i].pk = s[i/2].k;
    s[i].lk = s[2*i].k;
    s[i].rk = s[2*i+1].k;
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ", s[i].id, s[i].k);
    //if(s[i].pk!=NULL)
      printf("parent key = %d, ", s[i].pk);
    if(s[i].lk!=NULL)
       printf("left key = %d, ", s[i].lk); 
    if(s[i].rk!=NULL)
      printf("right key = %d, ", s[i].rk);
    printf("\n");
  }
}