#include using namespace std; #define int long long signed main(){ int T; cin>>T; while(T--){ int a,b,k; cin>>a>>b>>k; int t = lcm(a,b); int ad = (k/(t-t/a-t/b+1))*t; k %= (t-t/a-t/b+1); if(k == 0){ cout< 1){ int md = (l+r)/2; if(md-md/a-md/b <= k) l = md; else r = md; } cout<