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

#define N 1000001
#define nil NULL

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

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

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

int n;
int main(){
  int i,key;
  scanf("%d",&n);
  int A[n];
  for(i=1;i<=n;i++){
    scanf("%d",&key);
    A[i] = key;
  }
  for(i=1;i<=n;i++){
    int p = parent(i);
    int l = left(i);
    int r = right(i);
    printf("node %d: key = %d, ",i,A[i]);
    if(i!=1) printf("parent key = %d, ",A[p]);
    if(2*i<= n) printf("left key = %d, ",A[l]);
    if(2*i+1<=n) printf("right key = %d, ",A[r]);
    printf("\n");
  }
}