Binary tree code not getting same output

#include <bits/stdc++.h>
using namespace std;
#define ll long long
class node
{
public:
int data;
node* left;
node* right;
node(int data)
{
cin>>data;
left=NULL;
right=NULL;
}
};
// THIS FUNCTION helps to input in PRE-ORDER
node* insertion()
{
int d;
cin>>d;
if(d==-1)
{
return 0;
}
node *root=new node(d);
root->left=insertion();
root->right=insertion();

return root;	

}
// this function to print binary tree in PRE-ORDER
void print(node* root)
{
if(root==NULL)
{
return;
}
cout<data<<",";
print(root->left);
print(root->right);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// let’s play
node* root=insertion();
//insertion();
print(root);
return 0;
}