#include<iostream>
#include"math.h"
using namespace std;
int main()
{
float k=0;
long long a=0, b=0, ans=0;
int t=0;
cin >> t;
while(t--)
{
long long t1=0, t2=0;
cin >> k >> t1 >> t2; // Taking input in temprory variables.
float temp = k/2; //To know weather its even or odd.
cout << "k = " << k << endl;
a = max(t1, t2);//a will store max one
b = min(t1, t2);//b will store min one
//if (a-b > k/2)
if(a-b > temp)
{
ans = k-(a-b-1);
}
//if (a-b < k/2)
else if(a-b < temp)
{
ans = (a-b)-1;
}
//otherwise a:b is forming a diameter
else
{
ans = 0;
}
cout << ans << endl;
}
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlIm1hdGguaCIKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAppbnQgbWFpbigpCnsKICAgIGZsb2F0IGs9MDsKICAgIGxvbmcgbG9uZyBhPTAsIGI9MCwgYW5zPTA7CiAgICBpbnQgdD0wOwogICAgY2luID4+IHQ7CiAgICB3aGlsZSh0LS0pCiAgICB7CiAgICAgICAgbG9uZyBsb25nIHQxPTAsIHQyPTA7CgogICAgICAgIGNpbiA+PiBrID4+IHQxID4+IHQyOyAvLyBUYWtpbmcgaW5wdXQgaW4gdGVtcHJvcnkgdmFyaWFibGVzLgogICAgICAgIGZsb2F0IHRlbXAgPSBrLzI7IC8vVG8ga25vdyB3ZWF0aGVyIGl0cyBldmVuIG9yIG9kZC4KICAgICAgICAKICAgICAgICBjb3V0IDw8ICJrID0gIiA8PCBrIDw8IGVuZGw7CgogICAgICAgIGEgPSBtYXgodDEsIHQyKTsvL2Egd2lsbCBzdG9yZSBtYXggb25lCiAgICAgICAgYiA9IG1pbih0MSwgdDIpOy8vYiB3aWxsIHN0b3JlIG1pbiBvbmUKCiAgICAgICAgLy9pZiAoYS1iID4gay8yKQogICAgICAgIGlmKGEtYiA+IHRlbXApCiAgICAgICAgewogICAgICAgICAgICBhbnMgPSBrLShhLWItMSk7CiAgICAgICAgfQoKICAgICAgICAvL2lmIChhLWIgPCBrLzIpCiAgICAgICAgZWxzZSBpZihhLWIgPCB0ZW1wKQogICAgICAgIHsKICAgICAgICAgICAgYW5zID0gKGEtYiktMTsKICAgICAgICB9CgogICAgICAgIC8vb3RoZXJ3aXNlIGE6YiBpcyBmb3JtaW5nIGEgZGlhbWV0ZXIKICAgICAgICBlbHNlCiAgICAgICAgewogICAgICAgICAgICBhbnMgPSAwOwogICAgICAgIH0KCiAgICAgICAgY291dCA8PCBhbnMgPDwgZW5kbDsKICAgIH0KfSA=