#include<stdio.h>

int Parent(int);
int Left(int);
int Right(int);

int main(){
  int n,i,A[100001];

  scanf("%d",&n);

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

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

    if(Parent(i+1) >= 1) printf("parent key = %d, ",A[Parent(i+1)]);
    if(Left(i+1) <= n) printf("left key = %d, ",A[Left(i+1)]);
    if(Right(i+1) <= n) printf("right key = %d, ",A[Right(i+1)]);

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

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

int Left(int x){
  return 2 * x;
}

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

