1. Abridged Problem Statement
Given N subjects and M pupils where each pupil chooses exactly two distinct subjects, schedule all exams on two days so that no pupil has both their subjects on the same day. Output “yes” and one possible set of subjects for Day 1 (the rest go on Day 2), or “no” if it’s impossible.

2. Detailed Editorial

Problem Modeling
- Represent each subject as a vertex in an undirected graph of size N.
- For each pupil choosing subjects u and v, add an edge (u,v). That edge enforces that u and v must be on different days.

Goal
- Partition the vertex set into two groups (Day 1 and Day 2) such that every edge crosses between the groups.
- This is exactly the definition of a *bipartite graph*.

Solution Outline
1. Build the adjacency list of the graph in O(N + M) time.
2. Initialize a color array of size N with all entries = –1 (uncolored).
3. For each uncolored vertex, run a BFS (or DFS) to color its connected component:
   - Assign the start vertex color 0, push it into a queue.
   - While the queue is not empty, pop a vertex u; for each neighbor v of u:
     - If v is uncolored, assign color[v] = 1 – color[u], enqueue v.
     - If color[v] == color[u], conflict → graph is not bipartite → answer “no.”
4. If all components are colored without conflict, the graph is bipartite. Collect all vertices with color 0 → these go on Day 1. The rest go on Day 2.
5. Print “yes,” the count of Day 1 exams, and the list of those subjects (1-based indices).

Complexity
- Building adjacency lists: O(M).
- BFS over all vertices: O(N + M).
- Total: O(N + M), which is efficient for N ≤ 200, M ≤ 30 000.

3. C++ Solution
```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int n, m;
vector<vector<int>> adj;

void read() {
    cin >> n >> m;
    adj.assign(n, {});
    for(int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
}

bool is_bipartite(vector<int>& color) {
    queue<int> q;
    for(int i = 0; i < n; i++) {
        if(color[i] != -1) {
            continue;
        }
        color[i] = 0;
        q.push(i);
        while(!q.empty()) {
            int u = q.front();
            q.pop();
            for(int v: adj[u]) {
                if(color[v] == -1) {
                    color[v] = 1 - color[u];
                    q.push(v);
                } else if(color[v] == color[u]) {
                    return false;
                }
            }
        }
    }
    return true;
}

void solve() {
    // Each pupil's two subjects must fall on different days, so model subjects
    // as vertices and pupils as edges: a valid two-day split is exactly a
    // 2-colouring of this graph. BFS-colour every component; if any edge joins
    // two same-coloured subjects the graph is not bipartite and no schedule
    // exists. Otherwise the subjects coloured 0 form the first day's exams.

    vector<int> color(n, -1);
    if(is_bipartite(color)) {
        cout << "yes\n";
        vector<int> a;
        for(int i = 0; i < n; i++) {
            if(color[i] == 0) {
                a.push_back(i + 1);
            }
        }

        cout << a.size() << '\n';
        cout << a << '\n';
    } else {
        cout << "no\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}
```

4. Python Solution with Detailed Comments

```python
import sys
from collections import deque

def main():
    data = sys.stdin.read().split()
    # Parse integers
    it = iter(data)
    n = int(next(it))
    m = int(next(it))

    # Build adjacency list for n vertices (0-based)
    adj = [[] for _ in range(n)]
    for _ in range(m):
        u = int(next(it)) - 1
        v = int(next(it)) - 1
        adj[u].append(v)
        adj[v].append(u)

    # color[i] = -1 (unvisited), or 0/1 for two groups (days)
    color = [-1] * n

    def bfs_bipartite():
        for start in range(n):
            if color[start] != -1:
                continue
            # Start BFS from uncolored vertex
            color[start] = 0
            queue = deque([start])
            while queue:
                u = queue.popleft()
                for v in adj[u]:
                    if color[v] == -1:
                        color[v] = 1 - color[u]  # opposite day
                        queue.append(v)
                    elif color[v] == color[u]:
                        return False  # conflict → not bipartite
        return True

    if not bfs_bipartite():
        print("no")
        return

    # If bipartite, collect all vertices assigned day 0 → Day 1
    day1 = [i+1 for i in range(n) if color[i] == 0]
    print("yes")
    print(len(day1))
    print(*day1)

if __name__ == "__main__":
    main()
```

5. Compressed Editorial
- Model subjects as vertices and pupils’ pairs as edges.
- The requirement that no pupil has both exams on the same day is exactly the bipartiteness condition.
- Run BFS/DFS to 2-color each component; if a conflict arises, output “no.” Otherwise, output “yes” with all vertices colored 0 as one side.
