# Arup Guha
# 10/4/2026
# Hill Brute Force for CIS 3362 Homework #3

# We reduced the search space for a and c.
for a in range(3,26,13):
    for c in range(2,26,13):

        # Just do these in full.
        for b in range(26):
            for d in range(26):

                # Cheap relatively prime test...
                det = a*d-b*c
                if det%2 == 0 or det%13 == 0:
                    continue

                # We don't need to check the two equations we know are true...
                if (10*a + 4*b)%26 == 14 and (10*c+4*d)%26 == 6:
                    print(a,b,c,d)
