#include <iostream>
#include <vector>
#include <string>
using namespace std;
const int BASE = 1000000000;
#ifndef DBG
const int MAX = 100000;
#else
const int MAX = 500;
#endif
const string WHITESPACE = " \n\r\t\f\v";
void trim(string& s) {
s.erase(s.find_last_not_of(WHITESPACE) + 1);
s.erase(0,s.find_first_not_of(WHITESPACE));
}
struct big_num {
vector<int> a;
size_t size() const {
return a.size();
}
int& operator[](size_t index) {
return a[index];
}
int operator[](size_t index) const {
return a[index];
}
big_num(){}
bool operator==(const big_num& b) const {
if (a.size() == 0 || (a.size() == 1 && a[0] == 0)){
return b.size() == 0 || (b.size() == 1 && b[0] == 0);
}
if (a.size() == b.size()) {
for (size_t i = 0; i < a.size(); ++i) {
if (a[i] != b[i]) {
return false;
}
}
return true;
}
return false;
}
bool operator>(const big_num& b) const {
if (a.size() < b.size()) {
return false;
}
if (a.size() > b.size()) {
return true;
}
if (a.size() == 0) {
return b.size() > 1 || (b.size() == 1 && b[0] > 0);
}
for (int i = int(a.size()) - 1; i >= 0; --i) {
if (a[i] > b[i]) {
return true;
}
else if (a[i] < b[i]) {
return false;
}
}
return a[0] > b[0];
}
bool operator<=(const big_num& b) const {
return !(*this > b);
}
big_num(int n) {
while (n > 0) {
a.push_back(n % BASE);
n /= BASE;
}
}
void operator*=(int n) {
for (size_t i = 0, carry = 0; i < a.size() || carry > 0; ++i) {
if (i == a.size()) {
a.push_back(0);
}
int64_t product = a[i] * (int64_t) n + carry;
a[i] = product % BASE;
carry = product / BASE;
}
}
void operator/=(int n) {
if (a.size() != 0) {
int64_t remainder = 0;
int last_zero = a.size();
bool met_larger_than_zero = false;
for (int i = int(a.size()) - 1; i >= 0; --i) {
remainder = remainder * BASE + a[i];
a[i] = remainder / n;
remainder -= a[i] * (int64_t) n;
if (!met_larger_than_zero && a[i] > 0) {
last_zero = i + 1;
met_larger_than_zero = true;
}
}
//print();
a.resize(last_zero);
//print();
}
}
void read() {
string s;
cin >> s;
//cout<<s<<'\n';
trim(s);
//cout<<s<<'\n';
for (int i = s.size(); i > 0; i -= 9) {
a.push_back(stoi(s.substr(max(0, i - 9), min(i, 9))));
}
}
void print() {
if (a.empty()) {
printf("0\n");
return;
}
cout << a.back();
for (int i = int(a.size()) - 2; i >= 0; --i) {
printf("%09i", a[i]);
}
cout << '\n';
}
big_num(const big_num& b) {
a.assign(b.a.begin(), b.a.end());
}
};
big_num operator*(int n, const big_num& m) {
big_num ret(m);
ret *= n;
return ret;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
big_num p;
p.read();
//p.print();
big_num current_product(1);
//for (int i = p.a.size() - 1; i >= 0; --i) cout << p.a[i] << ' ';
for (int x = 1, y = 1; y <= MAX; ++y) {
current_product *= y;
while (current_product > p) {
current_product /= x;
x += 1;
}
if (current_product == p) {
cout << x << ' ' << y;
break;
}
}
return 0;
}