public class GcdClient
{
        protected static final Pairs.PairWithGcd pairR = new Pairs.PairWithGcdR(0, 0);
        protected static final Pairs.PairWithGcd pairI = new Pairs.PairWithGcdI(0, 0);
        
	protected static final String HINT = 
	   "Please call the gcd client with two integer arguments! ";

	public static void main (String[] args)
	{
		if (args.length < 2)
		{
			System.out.println("Missing Argument. " + HINT);
		}
		else
		{
                        Pairs.PairWithGcd pair;
                        if (args.length > 2 && 
			    Character.toLowerCase(args[2].charAt(0)) == 'r')
                        {
                                pair = pairR;
                        }
                        else
                        {
                                pair = pairI;
                        }
			try 
			{
				pair.set
				   (Integer.parseInt(args[0]), 
				    Integer.parseInt(args[1]));
				System.out.println(pair.gcd());
			} 
			catch (Exception e) 
			{
				System.out.println
				   ("Wrong Argument. " + HINT + e.toString());
			}
		}
	}
}