#include <typeinfo>
#include <iostream>
using namespace std;


void read_rational(Rational& r, bool& end);
void print_rational(const Rational& r);


int main() {

  { // Vigilem el tipus Racional.

    struct Racional_control {
      int num, den;
    };

    Rational r;
    Racional_control rc;

    // Diagn�stics en temps de compilaci�.
    r.num = rc.num;
    r.den = rc.den;

    // Diagn�stics en temps d'execuci�.
    if (sizeof(r) != sizeof(rc)) throw string("It seems that 'Rational' is not well defined");
    if (typeid(r.num) != typeid(rc.num)) throw string("It seems that 'Rational.num' is not well defined");
    if (typeid(r.den) != typeid(rc.den)) throw string("It seems that 'Rational.den' is not well defined");
  }

  // Xapuça provocada per en Jordi.
  int n;
  cin >> n;

  Rational r;
  bool final;
  read_rational(r, final);
  while (not final) {
    print_rational(r);
    cout << endl;
    read_rational(r, final);
  }
  return 0;
}
