#include <iostream>
#include <list>
#include <string>

using namespace std;

#include "BinaryTree.hpp"

template <typename T>
void writeListRec(typename list<T>::const_iterator it, typename list<T>::const_iterator end) {
  if (it != end) {
    cout << ", " << *it;
    writeListRec<T>(++it, end);
  }
}

template <typename T>
void write(const list<T> &l) {
  if (l.empty()) {
    cout << "[]" << endl;
  }
  else {
    cout << '[' << *l.begin();
    writeListRec<T>(++l.begin(), l.end());
    cout << ']' << endl;
  }
}

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	int n = v.size();
	if (n == 0) {
		os << "[]";
	}
	else {
		os << '[' << v[0];
		for (int i = 1; i < n; ++i) {
			os << ", " << v[i]; 
		}
		os << ']';
	}
	return os;
}
 

int main() {
	BinaryTree<int> t;
  while (cin >> t) {
    // Inv: s'ha mostrat el vector amb el mínim de cada profunditat
    // .dels arbres tractats fins el moment 
  	cout << t << " --> ";

    vector<int> res;
    t.minAtDepth(res);
    cout << res << endl;
  }
}
