import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto T = readln.chomp.to!int;

    while (T--) {
        auto s = readln.split.map!(to!long);
        auto A = s[0];
        auto B = s[1];
        auto D = abs(A - B);
        long tmp = 0;
        for (long i = 0; ; ++i) {
            tmp += i;
            if (tmp >= D && tmp % 2 == D % 2) {
                i.writeln;
                break;
            }
        }
    }

}
