def parent(i)
  return i/2
end
def left(i)
  return i*2
end
def right(i)
  return i*2+1
end
n=gets.to_i
arr=gets.split.map(&:to_i)
arr.unshift(nil)
(1..n).each do |i|
  print "node #{i}, key = #{arr[i]}, "
  if parent(i)>=1
    print "parent key = #{arr[parent(i)]}, "
  end
  if left(i)<=n
    print "left key = #{arr[left(i)]}, "
  end
  if right(i)<=n
    print "right key = #{arr[right(i)]}, "
  end
  puts ""
end