1. 

/**
* ACM Training 2010
* ACM Problem #10193 - All You Need Is Love
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=13&page=show_problem&problem=1134
*
* @author Felix Dietrich
* @version 1.0, 04/09/2010
*
* Methode: GCD
* Status : Accepted
* Runtime: 1.832
*/

import java.util.*;

public class Main
{
/**
* Greatest common divider of two numbers.
* @param a
* @param b
* @return gcd
*/
static int gcd(int a, int b)
{
if(a == 0)
return b;
while(b != 0)
if (a > b)
a = a - b;
else
b = b - a;
return a;
}

public static void main(String... strs)
{
Scanner sc = new Scanner(System.in);

int testcases = sc.nextInt();

for(int i=0; i<testcases; i++)
{
int s1 = sc.nextInt(2);
int s2 = sc.nextInt(2);

int a = gcd(s1,s2);

System.out.print(String.format("Pair #%d: ", i+1));
System.out.println(a != 1 ? "All you need is love!" : "Love is not all you need!");
}
}
}

2.

**
 *
 * Problem #10193 - All You Need Is Love
 * Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&page=show_problem&problem=1134

 *
 * @author Mariya Vlaseva
 *
 * Status : Accepted
 * Runtime: 1.816
 */

import java.util.*;

public class Main
{   
    public static void main(String... strs)
    {
        Scanner sc = new Scanner(System.in);

        //Anzahl Eingaben
        int count = sc.nextInt();
        //jede 2 Zeilen durchlaufen und vergleichen
        for(int i=0; i<count; i++)
        {
            int line1 = sc.nextInt(2);
            int line2 = sc.nextInt(2);

           
            int a = gcd(line1,line2);
           
            System.out.print(String.format("Pair #%d: ", i+1));
            System.out.println(a != 1 ? "All you need is love!" : "Love is not all you need!");

        }
    }
   
    static int gcd(int a, int b)
    {
        if(a == 0)
           return b;
        while(b != 0)
            if (a > b)
               a = a - b;
            else

               b = b - a;
        return a;
    }
}