#include using namespace std; typedef long long ll; const int N=1e5+6; int n,m; int main(){ int t; cin>>t; while(t--){ cin>>n>>m; if(n