#include using namespace std; //Macro Shorthands #define F first #define S second #define f(i, n) for (ll i = 0; i <= n; i++) #define rf(i, n) for (ll i = n; i >= 0; i--) #define Cf(i, a, b) for (ll i = a; i <= b; i++) #define Crf(i, b, a) for (ll i = b; i >= a; i--) #define pb push_back #define mp make_pair #define z ((ll)1e9 + 7) #define every(it, x) for (auto &it : x) #define SET(it, x) \ for (auto &it : x) \ { \ cin >> it; \ } #define ins insert #define INF ((ll)1e18) #define Test \ ll T; \ cin >> T; \ while (T--) #define all(v) v.begin(), v.end() #define nline cout << endl #define SZ(v) (ll) v.size() #define pll pair typedef long long ll; typedef vector vll; typedef vector> vvll; typedef vector vstr; typedef vector vchar; typedef vector> vpll; typedef set sll; typedef set sstr; typedef set> spll; typedef map mllll; typedef map mstrll; typedef queue qll; ll powMod(ll x, ll y) { ll p = 1; while (y) { if (y % 2) { p = (p * x) % z; } y /= 2; x = (x * x) % z; } return p; } ll CpowMod(ll x, ll y, ll w) { ll p = 1; while (y) { if (y % 2) { p = (p * x) % w; } y /= 2; x = (x * x) % w; } return p; } ll invMod(ll x) { return powMod(x, z - 2); } ll CinvMod(ll x, ll w) { return CpowMod(x, w - 2, w); } ll gcdd(ll a, ll b) { return b == 0 ? a : gcdd(b, a % b); } const ll mod = 1e9 + 7; bool cmp(pair&a,pair&b) { if(a.first == b.first) { return a.second < b.second; } else{ return a.first < a.second; } return false; } void call() { ll n;cin >> n; ll m ;cin >> m; vector>v(m); for(ll i =0 ;i < m;++i) { ll x,y;cin >> x >> y; v.push_back(make_pair(x,y)); } sort(v.begin(),v.end(),cmp); ll ans=0; vector>merged; merged.push_back(make_pair(-1,-1)); for(ll i=0;i> t; while (t--) { call(); } }