#include <bits/stdc++.h> using namespace std; class node{ public: int d; node* next; }; void printlinkedelements(node* i) { while(i!=NULL) { cout<<i->d<<" "<<i<<"\n"; i=i->next; } } void takeinput(node* i) { while(i!=NULL) { cin>>i->d; i=i->next; } } int main() { node* head=NULL; node* second=NULL; node* third=NULL; head=new node(); second=new node(); third=new node(); head->next=second; second->next=third; third->next=NULL; takeinput(head); printlinkedelements(head); return 0; }