• + 0 comments
    # ThinhNguyen97
    """
    I Miss Those Moments I Spent With You
    Kitchen
    Table
    Mirror
    Sofa
    """
    # Python is scripting language use interpreter
    # import numpy as np
    # import matplotlib.pyplot as plt
    # import pandas as pd
    from math import *
    from builtins import staticmethod
    from collections import Counter
    from collections import defaultdict
    from collections import namedtuple
    from collections import deque
    from queue import LifoQueue
    import heapq
    import functools
    import hashlib
    from datetime import datetime, timedelta
    import json
    import re
    from itertools import *
    import queue
    from bisect import bisect_left
    
    
    def solve(p, q):
        kaprekar_list = []
    
        for num in range(p, q + 1):
            square = num ** 2
            square_str = str(square)
            length = len(str(num))
    
            right_part = square_str[-length:]
            left_part = square_str[:-length] if square_str[:-length] else '0'
    
            if int(left_part) + int(right_part) == num:
                kaprekar_list.append(num)
    
        if kaprekar_list:
            print(*kaprekar_list)
        else:
            print("INVALID RANGE")
    
    
    def main():
        p = int(input())
        q = int(input())
        solve(p, q)
    
    
    if __name__ == '__main__':
        main()