description: She does her utmost to flawlessly carry out a person's last rites and preserve the world's balance of yin and yang.
  
  Hu Tao, being the little prankster she is, has tried to scare you with this graph problem! You are given a connected undirected graph of n nodes with m edges. You also have q queries. Each query consists of two nodes a and b.
  
  Initially, all edges in the graph have a weight of 0. For each query, you must choose a simple path starting from a and ending at b. Then you add 1 to every edge along this path. Determine if it's possible, after processing all q queries, for all edges in this graph to have an even weight. If so, output the choice of paths for each query. 
  
  If it is not possible, determine the smallest number of extra queries you could add to make it possible. It can be shown that this number will not exceed 10^{18} under the given constraints.
  
  A simple path is defined as any path that does not visit a node more than once.
  
  An edge is said to have an even weight if its value is divisible by 2.
  
  Input
  
  The first line contains two integers n and m (2 ≤ n ≤ 3 ⋅ 10^5, n-1 ≤ m ≤ min{\left((n(n-1))/(2), 3 ⋅ 10^5\right)}).
  
  Each of the next m lines contains two integers x and y (1 ≤ x, y ≤ n, x≠ y) indicating an undirected edge between node x and y. The input will not contain self-loops or duplicate edges, and the provided graph will be connected.
  
  The next line contains a single integer q (1 ≤ q ≤ 3 ⋅ 10^5).
  
  Each of the next q lines contains two integers a and b (1 ≤ a, b ≤ n, a ≠ b), the description of each query.
  
  It is guaranteed that nq ≤ 3 ⋅ 10^5.
  
  Output
  
  If it is possible to force all edge weights to be even, print "YES" on the first line, followed by 2q lines indicating the choice of path for each query in the same order the queries are given. For each query, the first line should contain a single integer x: the number of nodes in the chosen path. The next line should then contain x spaced separated integers p_i indicating the path you take (p_1 = a, p_x = b and all numbers should fall between 1 and n). This path cannot contain duplicate nodes and must be a valid simple path in the graph.
  
  If it is impossible to force all edge weights to be even, print "NO" on the first line and the minimum number of added queries on the second line.
  
  Examples
  
  Input
  
  
  6 7
  2 1
  2 3
  3 5
  1 4
  6 1
  5 6
  4 5
  3
  1 4
  5 1
  4 5
  
  
  Output
  
  
  YES
  2
  1 4
  4
  5 3 2 1
  5
  4 1 2 3 5
  
  
  Input
  
  
  5 7
  4 3
  4 5
  2 1
  1 4
  1 3
  3 5
  3 2
  4
  4 2
  3 5
  5 1
  4 5
  
  
  Output
  
  
  NO
  2
  
  Note
  
  Here is what the queries look like for the first test case (red corresponds to the 1st query, blue 2nd query, and green 3rd query): 
  
  <image> Notice that every edge in the graph is part of either 0 or 2 colored query edges.
  
  The graph in the second test case looks like this: 
  
  <image> There does not exist an assignment of paths that will force all edges to have even weights with the given queries. One must add at least 2 new queries to obtain a set of queries that can satisfy the condition.
solution: #include <bits/stdc++.h>
  using namespace std;
  const int MAXN = 1e6 + 10;
  const long long INF = 1e9 + 10;
  long long MOD = 1e9 + 7;
  long double EPS = 1e-12;
  void fastIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  int n, m, q;
  vector<vector<int> > v;
  bool was[MAXN];
  set<pair<int, int> > st;
  vector<int> dfs(int u, int endd) {
    was[u] = 1;
    if (u == endd) return {u + 1};
    for (auto to : v[u]) {
      if (was[to]) continue;
      if (st.find({min(u, to), max(u, to)}) == st.end()) continue;
      vector<int> res = dfs(to, endd);
      if (res.size() != 0) {
        st.erase({min(u, to), max(u, to)});
        res.push_back(u + 1);
        return res;
      }
    }
    for (auto to : v[u]) {
      if (was[to]) continue;
      if (st.find({min(u, to), max(u, to)}) != st.end()) continue;
      vector<int> res = dfs(to, endd);
      if (res.size() != 0) {
        st.insert({min(u, to), max(u, to)});
        res.push_back(u + 1);
        return res;
      }
    }
    return {};
  }
  int vp(int u) {
    was[u] = 1;
    int sum = 0, cnt = 0;
    for (auto to : v[u]) {
      if (st.find({min(u, to), max(u, to)}) == st.end()) continue;
      cnt++;
      if (was[to] == 0) sum += vp(to);
    }
    return sum + (int)(cnt == 1);
  }
  int main() {
    fastIO();
    cin >> n >> m;
    v.resize(n);
    for (int i = 0; i < m; i++) {
      int x, y;
      cin >> x >> y;
      v[x - 1].push_back(y - 1);
      v[y - 1].push_back(x - 1);
    }
    cin >> q;
    vector<vector<int> > ans;
    vector<int> cnt_from(n);
    while (q--) {
      int a, b;
      cin >> a >> b;
      a--;
      b--;
      cnt_from[a]++;
      cnt_from[b]++;
      fill(was, was + n, 0);
      vector<int> res = dfs(a, b);
      reverse(res.begin(), res.end());
      ans.push_back(res);
    }
    if (st.empty()) {
      cout << "YES\n";
      for (auto it : ans) {
        cout << it.size() << '\n';
        for (auto ver : it) cout << ver << ' ';
        cout << '\n';
      }
    } else {
      cout << "NO\n";
      int bad_cnt = 0;
      for (int i = 0; i < n; i++) {
        if (cnt_from[i] % 2 != 0) bad_cnt++;
      }
      cout << bad_cnt / 2;
    }
    return 0;
  }
  