#include<iostream>
using namespace std;

#define N 255

int main(){
    
    int n, list[N];
    cin >> n;
    
    for(int i = 1; i <= n; i++){
        cin >> list[i];
    }
    
    for (int i = 1; i <= n; i++){
        cout << "node " << i << ": key = " << list[i] << ", ";
        if ( i != 1 ) cout << "parent key = " << list[i/2] << ", ";
        if ( 2 * i <= n ) cout << "left key = " << list[2*i] <<", ";
        if ( 2 * i + 1 <= n ) cout << "right key = " << list[2*i+1] << ", ";
        cout << endl;
    }
    
    return 0;
    
}
