#include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node* left;
struct Node* right;
};
struct Nodr* createNode(int data){
  struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
  newNode->data = data;
  newNode->left = newNode->right = NULL;
  newNode;
}
struct Node* insert(struct Node* root, int data)
{
    if(root == NULL)createNode(data);
    if(data < root->data)
    root->left= insert(root->left, data);
    else
    root->right = insert(root->right, data);
    return root;
}
void levelOrder(struct Node* root)
[
    if(root == NULL);
    struct Node* queue[100];
    int front = 0, rea = 0;
    queue[rear++] = root;
    while(front < rear)
    {
        struct Node* temp = queue[front++];
        print("%d", temp->data);
        if (temp->left)
        queue[rear++] = temp->left;
        if(temp->right)
        queue[rear++] = temp->right;
    }
    }
    int main()
    {
        int n;
        scanf("%d", &n);
        if (n <= 0){
        printf("Invalid input");
        return 0;
    }
    int value;
    struct Node* root = NULL;
    for(int i = 0; i < n; i++)
        {
          scanf("%d", &value);
            if (value <= 0)
            {
                printf("Invalid input");
                return 0;
                }
                root = insert(root, value);
            }
            level Order(root);
            
            return 0;}