<p>In a town, there are <code>n</code> people labeled from <code>1</code> to <code>n</code>. There is a rumor that one of these people is secretly the town judge.</p>

<p>If the town judge exists, then:</p>

<ol>
	<li>The town judge trusts nobody.</li>
	<li>Everybody (except for the town judge) trusts the town judge.</li>
	<li>There is exactly one person that satisfies properties <strong>1</strong> and <strong>2</strong>.</li>
</ol>

<p>You are given an array <code>trust</code> where <code>trust[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> representing that the person labeled <code>a<sub>i</sub></code> trusts the person labeled <code>b<sub>i</sub></code>. If a trust relationship does not exist in <code>trust</code> array, then such a trust relationship does not exist.</p>

<p>Return <em>the label of the town judge if the town judge exists and can be identified, or return </em><code>-1</code><em> otherwise</em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> n = 2, trust = [[1,2]]
<strong>Output:</strong> 2
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> n = 3, trust = [[1,3],[2,3]]
<strong>Output:</strong> 3
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> n = 3, trust = [[1,3],[2,3],[3,1]]
<strong>Output:</strong> -1
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n &lt;= 1000</code></li>
	<li><code>0 &lt;= trust.length &lt;= 10<sup>4</sup></code></li>
	<li><code>trust[i].length == 2</code></li>
	<li>All the pairs of <code>trust</code> are <strong>unique</strong>.</li>
	<li><code>a<sub>i</sub> != b<sub>i</sub></code></li>
	<li><code>1 &lt;= a<sub>i</sub>, b<sub>i</sub> &lt;= n</code></li>
</ul>

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

static const bool Booster = [](){
    std::ios_base::sync_with_stdio(false);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
    return true;
}();

inline bool is_digit_or_minus_sign(char c) {
    return (c >= '0' && c <= '9') || (c == '-');
}

template <int VEC_LEN>
std::vector<std::vector<int>> parse_input_data_string(const std::string& s) {
    std::vector<std::vector<int>> input_data_2D;
    const int N = s.size();

    std::vector<int> tmp_vec(VEC_LEN);
    int left = 0;
    int column = 0;
    while (left < N) {
        if (!is_digit_or_minus_sign(s[left])) {
            ++left;
            continue;
        }
        int right = left + 1;
        while (right < N && is_digit_or_minus_sign(s[right])) {
            ++right;
        }
        tmp_vec[column] = std::stoi(s.substr(left, right - left));
        left = right;
        ++column; 
        if (column == VEC_LEN) {
            input_data_2D.push_back(tmp_vec);
            column = 0;
        }
    }
    return input_data_2D;
}

int findJudge(int n, std::vector<std::vector<int>>& trust) {        
    int16_t trustScore[1001]{};
    for(const auto& t: trust) {
        trustScore[t[0]]--;
        trustScore[t[1]]++;
    }
    for(int i = 1; i <= n; ++i) {
        if(trustScore[i] == n - 1) {
            return i;
        }
    }
    return -1;
}

bool Solve = [](){
    std::ofstream out("user.out");
    for (std::string s; std::getline(std::cin, s);) {
        const int n = std::stoi(s);
        std::getline(std::cin, s);

        constexpr int vec_length = 2;
        std::vector<std::vector<int>> input_data = parse_input_data_string<vec_length>(s);
        out << findJudge(n, input_data) << "\n";
    }
    out.flush();
    exit(0);
    return true;
}();


class Solution {
public:
    int findJudge(int n, vector<vector<int>>& trust) {
        return 0;
    }
};


32604