Node *Reverse(Node *&head)
{
if (head == NULL || head->next == NULL)
return head;
Node *NewHead = Reverse(head->next);
head->next->next = head;
head->next = NULL;
return NewHead;
}
//in main the previous head becomes the last node
int main(){
Node*newHead=Reverse(head);
print(newhead);
}