#include <iostream>
using namespace std;
struct nod {
nod* next = NULL;
nod* ante = NULL;
int data;
};
bool este_palindrom(nod* front) {
//Gaseste ultimul nod
nod* end=front;
while (end->next)end = end->next;
//Parcurge si comparare din ambele sensuri
while (front != end && front->ante != end) {
if (front->data != end->data) return 0;
front = front->next;
end = end->ante;
}
return 1;
}
int main() {
nod a, b, c;
a.next = &b;
b.ante = &a;
b.next = &c;
c.ante = &b;
a.data = 1;
b.data = 2;
c.data = 1;
cout << este_palindrom(&a);
}