import java.util.*;

/*
public class ListNode {
    int val;
    ListNode next = null;

    ListNode(int val) {
        this.val = val;
    }
}*/
public class Palindrome {
    public boolean isPalindrome(ListNode pHead) {
        // write code here
        ListNode a = pHead;
        int[] num = new int [10000];
        int i =0;
        int l =0;
        while(a!=null){
            num[i]=a.val;
            i++;
            l++;
            a=a.next;
        }
        for(i =0; i<l/2;i++){
            if(num[i]!=num[l-i-1]){
                return false;
            }
        }
        return true;

    }
}