#include <iostream>
using namespace std;
struct Node{
int data;
Node* pNext;
};
Node* findX(Node* pFirst, int x);
//-----------------------------------------------------//
Node* findX(Node* pFirst, int x) {
Node* cur=pFirst;
if(pFirst == nullptr)
return nullptr;
while(cur->data != x && cur->pNext != pFirst)
cur = cur->pNext;
if(cur->data == x)
return cur;
return nullptr;
}
//-----------------------------------------------------//
int main() {}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IE5vZGV7CiAgICBpbnQgZGF0YTsKICAgIE5vZGUqIHBOZXh0Owp9OwoKTm9kZSogZmluZFgoTm9kZSogcEZpcnN0LCBpbnQgeCk7CgovLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLy8KCk5vZGUqIGZpbmRYKE5vZGUqIHBGaXJzdCwgaW50IHgpIHsKICAgIE5vZGUqIGN1cj1wRmlyc3Q7CiAgICBpZihwRmlyc3QgPT0gbnVsbHB0cikKICAgICAgICByZXR1cm4gbnVsbHB0cjsKICAgIHdoaWxlKGN1ci0+ZGF0YSAhPSB4ICYmIGN1ci0+cE5leHQgIT0gcEZpcnN0KQogICAgICAgIGN1ciA9IGN1ci0+cE5leHQ7CiAgICBpZihjdXItPmRhdGEgPT0geCkKICAgICAgICByZXR1cm4gY3VyOwogICAgcmV0dXJuIG51bGxwdHI7Cn0KCi8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0vLwoKaW50IG1haW4oKSB7fQ==