// Header Files
#include<iostream.h>
#include <list>
using namespace std;
ostream& operator<< (ostream& os, const list&lst;)
{
for(auto elm: lst) {
os << " " << elm;
}
return os;
}
int main ()
{
list<int> listA;
list<int> listB;
for(int i = 1; i < 6; i++) listA.push_back(i);
for(int i = 1; i < 6; i++) listB.push_back(i*100);
cout << "listA: " << listA << endl;
cout << "listB: " << listB << endl;
auto iter = listA.begin();
advance(iter, 3);
listA.splice(iter, listB);
cout << "listA: " << listA << endl;
cout << "listB: " << listB << endl;
listB.splice(listB.begin(), listA, iter, listA.end());
cout << "listA: " << listA << endl;
cout << "listB: " << listB << endl;
return 0;
}