<|instruction|>
Solve the below problem. The solution should start with an abridged problem statement. Then key observations. Then full solution based on the observations. Then C++ and Python implementations with comments.

443. Everlasting...?
Time limit per test: 0.5 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

Everlasting Sa-Ga, a new, hot and very popular role-playing game, is out on October 19, 2008. Fans have been looking forward to a new title of Everlasting Sa-Ga. Little Jimmy is in trouble. He is a seven-year-old boy, and he obtained the Everlasting Sa-Ga and is attempting to reach the end of the game before his friends. However, he is facing difficulty solving the riddle of the first maze in this game — Everlasting Sa-Ga is notorious in extremely hard riddles like Neverending Fantasy and Forever Quest. The riddle is as follows. There are two doors on the last floor of the maze: the door to the treasure repository and the gate to the hell. If he wrongly opens the door to the hell, the game is over and his save data will be deleted. Therefore, he should never open the wrong door. So now, how can he find the door to the next stage? There is a positive integer given for each door — it is a great hint to this riddle. The door to the treasure repository has the integer that gives the larger key number. The key number of a positive integer n is the largest prime factor minus the total sum of any other prime factors, where the prime factors are the prime numbers that divide into n without leaving a remainder. Note that each prime factor should be counted only once. As an example, suppose there are doors with integers 30 and 20 respectively. Since 30 has three prime factors 2, 3 and 5, its key number is 5 - (2 + 3) = 0. Similarly, since 20 has two prime factors 2 and 5, its key number 20 is 5 - 2 = 3. Jimmy therefore should open the door with 20. Your job is to write a program to help Jimmy by solving this riddle.
Input
The input consists of a line that contains two integers a and b separated by a space (2 ≤ a, b ≤ 106). It is guaranteed that key numbers of these integers are always different.
Output
Print in a line 'a' (without quotes) if the door with the integer a is connected to the treasure repository; print 'b' otherwise.
Example(s)
sample input
sample output
10 15
a

sample input
sample output
30 20
b

<|response|>
1. Abridged Problem Statement  
You are given two integers a and b (2 ≤ a, b ≤ 10^6). For each integer n, define its key number as follows: let its distinct prime divisors be p₁, p₂, …, p_k, let M = max(p_i) and S = ∑p_i, then  
 key(n) = M − (S − M) = 2·M − S.  
It is guaranteed key(a) ≠ key(b). Print “a” if key(a) > key(b), otherwise print “b”.

2. Key Observations  
- We only need the distinct prime factors of n.  
- If the distinct primes are {p₁,…,p_k}, then key(n) = 2·max(p_i) − (p₁+…+p_k).  
- n ≤ 10^6, so trial‐division up to √n (≈1000) is efficient.  
- We do this twice (for a and b) and compare their keys.

3. Full Solution Approach  
- Read integers a and b.  
- For each x in {a, b}:  
  1. Initialize an empty list of primes, sum = 0, maxP = 0.  
  2. For i from 2 to ⌊√x⌋:  
     - If i divides x, record i once (add to sum, update maxP); then divide x by i until it no longer divides.  
  3. If after that x > 1, x itself is a prime >√original: record it.  
  4. Compute key(x) = 2·maxP − sum.  
- Compare key(a) and key(b). Print “a” if key(a) > key(b), else “b”.

Time complexity: O(√a + √b) ≈ O(2000) worst‐case, well within limits.

4. C++ Implementation with Detailed Comments  
```cpp
#include <bits/stdc++.h>
using namespace std;

// Compute the key number of n: 2*max_prime - sum_of_distinct_primes
int compute_key(int n) {
    int original = n;
    int sumPrimes = 0;
    int maxPrime = 0;

    // Trial division from 2 up to sqrt(n)
    for (int p = 2; p * p <= n; ++p) {
        if (n % p == 0) {
            // p is a distinct prime factor
            sumPrimes += p;
            maxPrime = max(maxPrime, p);
            // Remove all powers of p
            while (n % p == 0) {
                n /= p;
            }
        }
    }
    // If remainder > 1, it's a prime factor > sqrt(original)
    if (n > 1) {
        sumPrimes += n;
        maxPrime = max(maxPrime, n);
    }
    // key = 2*maxPrime - sumPrimes
    return 2 * maxPrime - sumPrimes;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int a, b;
    cin >> a >> b;

    int keyA = compute_key(a);
    int keyB = compute_key(b);

    // Output according to which key is larger
    if (keyA > keyB) {
        cout << "a\n";
    } else {
        cout << "b\n";
    }
    return 0;
}
```

5. Python Implementation with Detailed Comments  
```python
import sys
import math

def compute_key(n):
    """
    Compute key(n) = 2*max(distinct_primes) - sum(distinct_primes)
    via trial division up to sqrt(n).
    """
    sum_primes = 0
    max_prime = 0
    x = n

    # Check factor 2
    if x % 2 == 0:
        sum_primes += 2
        max_prime = 2
        while x % 2 == 0:
            x //= 2

    # Check odd factors from 3 to sqrt(x)
    p = 3
    while p * p <= x:
        if x % p == 0:
            sum_primes += p
            max_prime = max(max_prime, p)
            while x % p == 0:
                x //= p
        p += 2

    # If remainder > 1, it's a prime
    if x > 1:
        sum_primes += x
        max_prime = max(max_prime, x)

    return 2 * max_prime - sum_primes

def main():
    # Read two integers from stdin
    a, b = map(int, sys.stdin.readline().split())

    # Compute and compare keys
    if compute_key(a) > compute_key(b):
        print("a")
    else:
        print("b")

if __name__ == "__main__":
    main()
```