Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X*0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        #elif (a**3 > x**3*2) and check < a:
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")




Fixed submission:
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X**0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        #elif (a**3 > x**3*2) and check < a:
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    check = (float(X)/float(x) - x**4)**0.25 
    if (float(X)/float(x) - x**4)<=0:
        check=-1
    flag=0
    while(True):
        if fn(a,x) == X/x - x**4:
            flag=1
            print(a, a-x)
            break
        if (a**3 > x**3*2) and check < a:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")




Fixed submission:
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X**0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        #elif (a**3 > x**3*2) and check < a:
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    check = (float(X)/float(x) - x**4)**0.25 
    if (float(X)/float(x) - x**4)<=0:
        check=-1
    flag=0
    while(True):
        if fn(a,x) == X/x - x**4:
            flag=1
            print(a, a-x)
            break
        if (a**3 > x**3*10) and check < a:
            break
        a+=1
    if flag==1:
        break
        





Fixed submission:
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X**0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        #elif (a**3 > x**3*2) and check < a:
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")