#include #include #include template > class Heap { public: class Node { T value; Node *father = nullptr, *left = nullptr, *right = nullptr; }; Node* root = nullptr; Node* push(T value) { if (root == nullptr) { return root = new Node(value); } Node* node = root; while (node->right != nullptr) { node = node->right; } if (node->left == nullptr) { return node->left = new Node({.value = value, .father = node}); } return node->right = new Node({.value = value, .father = node}); } void swap(Node* a, Node* b) { if (a->left != nullptr) { a->left->father = b; } if (a->right != nullptr) { a->right->father = b; } if (b->left != nullptr) { b->left->father = a; } if (b->right != nullptr) { b->right->father = a; } std::swap(a, b); } void swim(Node* node) {} }; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); return 0; }