#include using namespace std; int main() { int N; cin >> N; for (int i = 0; i < N; i++){ int A, B; cin >> A >> B; cout << (int) sqrt(A) + sqrt(B) + 1 << '\n'; } }