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

int Parent(int a){
  return a/2;
}

int Left (int a){
  return a*2;
}
int Right (int a){
  return a*2 + 1;
}

int main (){
  int n,i;
  int *A;

  scanf("%d",&n);

  A = malloc(sizeof(int) * (n+1));

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

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

    if(Parent(i) != 0)printf(" parent key = %d,",A[Parent(i)]);

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

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

    printf(" \n");
  }

  return 0;
}

