//Haha TTpro
//SIMPLE spoj
//http://www.spoj.com/problems/SIMPLE/

#include <iostream>
using namespace std;



void inRation(long &a, long &b);
void outRation(int Ca,long &a, long &b);
int GCD(long a, long b);
void MakeItSimple(long &a, long &b);
int main()
{
    int t;
    cin >>t;
    int i;
    long a,b;
    for (i=1;i<=t;i++)
    {
    inRation(a,b);
    MakeItSimple(a,b);
    outRation(i,a,b);
    }
}


void inRation(long &a, long &b)
{
 cin >>a;
 cin.ignore(1);
 cin >>b;
}

void outRation(int Ca,long &a, long &b)
{
    cout<<"Case "<<Ca<<": "<<a<<"/"<<b<<endl;
}

int GCD(long a, long b)
{
    int c;
    if (a<b)
    {
        c=a;
        a=b;
        b=c;
    }
    int r;
    while (true)
    {
        r=a%b;
        if (r==0) return b;
        a=b;
        b=r;
    }
}

void MakeItSimple(long &a, long &b)
{
    int G;
    G=GCD(a,b);
    a=a/G;
    b=b/G;
}
