// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define patkan 9
#define tisic 47
#define soclose 10e-7
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
// mylittlepony
using namespace std;
long long gcd(long long x, long long y) {
if(x > y) swap(x,y);
if(x == 0) return y;
return gcd(y%x,x);}
struct frac {
long long n,d;
frac() {}
frac(long long a, long long b) {n =a, d =b;}
bool operator<(const frac &A) const {
return n*A.d < d*A.n;}
};
int main() {
// freopen("zanzibar.in","r",stdin);
int T;
scanf(" %d",&T);
set<frac> P;
queue<frac> q;
P.insert(frac(0,1));
q.push(frac(0,1));
while(!q.empty()) {
frac p =q.front();
for(int a =1; a < 13; a++) for(int b =a+1; b <= 13; b++) {
long long x =p.n*b+p.d*a;
long long y =p.d*b;
long long d =gcd(x,y);
x /=d, y /=d;
if(x >= y) continue;
if(P.find(frac(x,y)) == P.end()) q.push(frac(x,y));
P.insert(frac(x,y));}
q.pop();}
for(int t =0; t < T; t++) {
long long a,b;
scanf(" %lld %lld",&a,&b);
frac fbest(a,b);
if(P.lower_bound(frac(a,b)) != P.end()) {
frac f =*P.lower_bound(frac(a,b));
frac fdif(abs(f.n*b-a*f.d),b*f.d);
long long d =gcd(fdif.n,fdif.d);
fdif.n /=d, fdif.d /=d;
if(fdif < fbest) fbest =fdif;}
if(a > 0) {
frac f =*(--P.lower_bound(frac(a,b)));
frac fdif(abs(f.n*b-a*f.d),b*f.d);
long long d =gcd(fdif.n,fdif.d);
fdif.n /=d, fdif.d /=d;
if(fdif < fbest) fbest =fdif;}
long long d =gcd(fbest.n,fbest.d);
fbest.n /=d, fbest.d /=d;
printf("Case %d: %lld/%lld\n",t+1,fbest.n,fbest.d);}
return 0;}
//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