#include <stdio.h>
#define H 250

int main(){
    int A[H], i, n, p, l, r; //l means left index, r is right one 

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

    //print
    for(i = 1; i<=n; i++){
	p = i / 2;
	l = 2 * i;
	r = l + 1;
	printf("node %d: key = %d, ", i, A[i]);
	//when the node has an parent
	if(i != 1) printf("parent key = %d, ", A[p]);
	//when the node has left key
	if(l <= n) printf("left key = %d, ", A[l]);
	//when the node has right key
	if(r <= n) printf("right key = %d, ", A[r]);
	printf("\n");
    }
    return 0;
}

