#include <stdio.h>
int main() {
int a,b,j=0,c=1,m=0,p=0,q=0,C=1,M=0,h,H;
int x[10000],y[10000];
scanf("%d %d",&a,&b);
while(a>c)
{
c*=10;
m++;
}
while(b>C)
{
C*=10;
M++;
}
for(int i=c/10;i>0;i/=10)
{
x[j]=a/i;
a=a-(x[j]*i);
j++;
}
j=0;
for(int i=C/10;i>0;i/=10)
{
y[j]=b/i;
b=b-(y[j]*i);
j++;
}
for(int i=3;i<4;i++)
{
for(int k=m-1,h=1;0<=k;k--)
{
p+=(x[k]*h);
h=h*i;
for(int j=6;j<7;j++)
{
for(int K=M-1,H=1;0<=K;K--)
{
q+=(y[K]*H);
H=H*j;
}
}
if(p==q)
{
printf("%d %d",h,H);
}
p=0;
q=0;
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: