#include <stdio.h>

#define MAX 251

int parent(int i);
int left(int i);
int right(int i);

int main(){
  int tree[MAX],n;
  int i;

  scanf("%d",&n);

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

  for (i = 1;i <= n;i++){
    printf("node %d: ",i);
    printf("key = %d, ",tree[i]);
    
    if (parent(i) >= 1)
      printf("parent key = %d, ",tree[parent(i)]);

    if (left(i) <= n)
      printf("left key = %d, ",tree[left(i)]);

    if (right(i) <= n)
      printf("right key = %d, ",tree[right(i)]);

    printf("\n");
  }
  
  return 0;
}

int parent(int i){
  return i/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2 + 1;
}

