-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB.cpp
More file actions
40 lines (39 loc) · 983 Bytes
/
B.cpp
File metadata and controls
40 lines (39 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define q(v, n) for(ll i = 0 ; i <n;i++)cin>>v[i];
#define out(v) {for(auto &a : v)cout<<a<<' ';cout<<endl;}
#define re resize
#define all(v) v.begin(),v.end()
#define no {printf("%s\n","NO");return 0;};
#define yes {printf("%s\n","YES");return 0;};
#define minus {printf("%s\n","-1");return 0;};
#define IM INT_MAX
#define Cin cin
#define inti ll i
#define intj ll j
#define OR or
const int N = 1e4 + 69;
signed main() {
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
set<int>s;
for(int i =1;i<=n;i++)s.insert(i);
for(int i = 0 ; i<m;i++){
int a,b,c;
cin>>a>>b>>c;
s.erase(b);
}
int x = *s.begin();
for(int i = 1;i<=n;i++){
if(i!=x){
cout<<x<<' '<<i<<endl;
}
}
}
}