class Solution {
public:
    
    vector<int> PrintFromTopToBottom(TreeNode* root) {
        if(root==NULL)return {};
        queue<TreeNode*>q;
        vector<int>v;
        q.push(root);
        while(!q.empty()){
            TreeNode*r=q.front();
            q.pop();
            if(r->left!=NULL)q.push(r->left);
            if(r->right!=NULL)q.push(r->right);
            v.push_back(r->val);
        }
        return v;
        
    }
};