#include
#include
using namespace std;
int main()
{
list lst;
int i;
for(i=0; i<10; i++) lst.push_back(i);
cout << "List printed forwards:\n";
list::iterator p = lst.begin();
while(p != lst.end()) {
cout << *p << endl;
p++;
}
cout << "List printed backwards:\n";
p = lst.end();
while(p != lst.begin()) {
p--;
cout << *p << " ";
}
return 0;
}