#include <iostream>
#include <set>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class FindElements {
private:
set<int> vals;
public:
FindElements(TreeNode* root) {
if(root) dfs(root, 0);
}
bool find(int target) {
return vals.find(target) != vals.end();
}
private:
void dfs(TreeNode* node, int val){
node->val = val;
vals.insert(val);
if(node->left) dfs(node->left, val * 2 + 1);
if(node->right) dfs(node->right, val * 2 + 2);
}
};
int main() {
return 0;
}