Help me in solving SESO05 problem

My issue

Can you provide me answer of this problem?

My code

#include <iostream>
using namespace std;

int main() {
    int n, a, b;
    cin >> n; // Input the number of pairs
    cin >> a >> b; // Input the integers a and b to check for

    bool found = false;

    // Loop through each pair of integers
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y; // Input each pair of integers

        // Check if the pair contains both a and b in any order
        if ((x == a && y == b) || (x == b && y == a)) {
            found = true;
            break; // No need to check further once we find the pair
        }
    }

    if (found) {
        cout << "Yes" << endl; // Print "Yes" if the pair is found
    } else {
        cout << "No" << endl; // Print "No" if no such pair exists
    }

    return 0;
}

Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/college-dsa-c/COLDSC09/problems/SESO05