func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   long long power(long long a, long long b) {     if (b == 0)       return 1;     else if (b == 1) {       return a;     } else if (b & 1) {       return (a % mod * power((a % mod * a % mod) % mod, b / 2)) % mod;     } else {       return (power((a % mod * a % mod) % mod, b / 2)) % mod;     }   }   void solve() {     int n, m, a, b;     cin >> n >> m;     vector<int> adj[n + 1];     vector<int> deg(n + 1, 0), ans, dis(n + 1, 0), odd, even;     for (long long i = 0; i < m; i++) {       cin >> a >> b;       adj[a].push_back(b);       adj[b].push_back(a);       deg[a]++;       deg[b]++;     }     queue<pair<int, int> > q;     vector<bool> vis(n + 1, false);     q.push({1, 0});     vis[1] = 1;     while (!q.empty()) {       auto it = q.front();       q.pop();       dis[it.first] = it.second;       for (int j : adj[it.first]) {         if (!vis[j]) {           vis[j] = 1;           q.push({j, dis[it.first] + 1});         }       }     }     for (int i = 1; i <= n; i++) {       if (dis[i] & 1) {         odd.push_back(i);       } else {         even.push_back(i);       }     }     if (odd.size() > even.size()) {       cout << even.size() << endl;       for (int i = 0; i < even.size(); i++) {         cout << even[i] <<    ;       }       cout << endl;     } else {       cout << odd.size() << endl;       for (int i = 0; i < odd.size(); i++) {         cout << odd[i] <<    ;       }       cout << endl;     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       solve();     }   }   