//Bismillahir Rahmanir Rahim
/******A.K.M Harunur Rashid******/
/***********Template Starts Here***********/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<cassert>
#include<string>
#include<vector>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;
#define MEM(a,b) memset(a,b,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)>(b)?(b):(a))
#define ABS(a) ((a)>0? (a):(-(a)))
#define SQ(a) ((a)*(a))
#define SZ(a) (int)a.size()
#define FORN(i,n) for(i=1;i<=n;i++)
#define FORAB(i,a,b) for(i=a;i<=b;i++)
#define ALL(V) V.begin(),V.end()
#define pb(a) push_back(a)
#define pr(a) cout<<a<<endl
#define SQR(a) ((a)*(a))
#define pf printf
#define sf scanf
#define mp make_pair
#define Swap(a,b) (a^=b,b^=a,a^=b)
#define PI acos(-1)
#define x first
#define y second
#define eps 1e-7
typedef int D;
typedef long long int LLD;
typedef unsigned long long int LLU;
typedef vector<D> VI;
typedef set<D> SI;
typedef vector<D>::iterator Viti;
/***********Template Ends Here***********/
int main()
{
LLU w,h;
while(1)
{
cin>>w>>h;
if(w==0 && h==0) break;
if(w==h)
printf("1\n");
else
{
if(w<h) Swap(w,h);
if(w%h==0) printf("%llu\n",w/h);
else printf("%llu\n",w*h/__gcd(w,h));
}
}
return 0;
}
Ly9CaXNtaWxsYWhpciBSYWhtYW5pciBSYWhpbQovKioqKioqQS5LLk0gSGFydW51ciBSYXNoaWQqKioqKiovCi8qKioqKioqKioqKlRlbXBsYXRlIFN0YXJ0cyBIZXJlKioqKioqKioqKiovCiNpbmNsdWRlPGlvc3RyZWFtPgojaW5jbHVkZTxjc3RkaW8+CiNpbmNsdWRlPGNzdHJpbmc+CiNpbmNsdWRlPGNtYXRoPgojaW5jbHVkZTxjY3R5cGU+CiNpbmNsdWRlPGNzdGRsaWI+CiNpbmNsd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