func_code_string: #include <bits/stdc++.h>   using namespace std;   long long t, m, n, a, u, v;   void printAnswer(vector<int> ans) {     sort(ans.begin(), ans.end());     cout << ans.size() << endl;     for (int i = 0; i < ans.size(); i++) {       cout << ans[i] <<    ;     }     cout << endl;   }   int main() {     cin >> t;     for (int j = 0; j < t; j++) {       cin >> n >> m;       vector<vector<int> > G(n + 1);       for (int i = 0; i < m; i++) {         cin >> v >> u;         G[v].push_back(u);         G[u].push_back(v);       }       vector<int> odd;       vector<int> even;       bool seen[n + 1];       for (int i = 0; i <= n; i++) {         seen[i] = false;       }       bool oddLevel = true;       vector<int> currLevel;       currLevel.push_back(1);       seen[1] = true;       while (currLevel.size() > 0) {         if (oddLevel) {           odd.insert(odd.end(), currLevel.begin(), currLevel.end());         } else {           even.insert(even.end(), currLevel.begin(), currLevel.end());         }         vector<int> nextLevel;         for (int i = 0; i < currLevel.size(); i++) {           int n = currLevel[i];           for (int k = 0; k < G[n].size(); k++) {             if (!seen[G[n][k]]) {               seen[G[n][k]] = true;               nextLevel.push_back(G[n][k]);             }           }         }         currLevel = nextLevel;         oddLevel = !oddLevel;       }       if (odd.size() >= even.size()) {         printAnswer(even);       } else {         printAnswer(odd);       }     }     return 0;   }   