import math
from sympy import Range


def is_prime(number: int) -> bool:
    for i in Range(2, math.sqrt(number)):
        if number % i == 0:
            return False
    return True


def generate_twins(start: int, end: int) -> None:
    for i in Range(start, end):
        j = i + 2
        if (is_prime(i) and is_prime(j)):
            print("{:d} and {:d}".format(i, j))


if __name__ == '__main__':
    lower_limit: int = int(input("Enter the lower limit: "))
    higher_limit: int = int(input("Enter the higher limit: "))
    generate_twins(lower_limit, higher_limit)
