#include<iostream>
using namespace std;

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