from fractions import gcd
b,D=map(int,raw_input().split())
a=200*[0]
z=200*[0]
for d in range(2,101):
	c=0
	t=d
	while gcd(b,t)>1:
		t/=gcd(b,t)
		c+=1
	if t==1:
		a[d]=2
		z[d]=c
		continue
	if b%d==1:
		a[d]=3
		continue
	if (b+1)%d==0:
		a[d]=11
		continue
	a[d]=7
	for i in range(2,d):
		if d%i==0 and gcd(i,d/i)==1 and a[i]!=7 and a[d/i]!=7:
			a[d]=6
print "%d-type"%a[D]
if a[D]==2:
	print z[D]

b, d = map(int, input().split())
for i in range(1, 10):
    if (b**i) % d == 0:
        print("2-type")
        print(i)
        exit()
if (b-1) % d == 0:
    print("3-type")
    exit()
if (b+1) % d == 0:
    print("11-type")
    exit()
for i in range(2, d+1):
    if d % i == 0:
        x = 1
        while d % i == 0:
            d /= i
            x *= i
        if (b**10) % x != 0 and (b+1) % x != 0 and (b-1) % x != 0:
            print("7-type")
            break
else:
    print("6-type")

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(100):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      for i in range(2, 100):
            cur = 1
            while x % i == 0:
                  cur *= i
                  x /= i
            if cur != 1 and b % i:
                  if not(typeTwo(cur) or typeThree(cur) or typeEleven(cur)):
                        return False
      return True

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
elif typeSix(d):
      print '6-type'
else:
      print '7-type'

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ch
		if(sum%div!=0):
			#print sum,div
			return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ch
			else:
				eve+=ch
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def checkTypeSechs(base,div):
	factor=[]
	for i in xrange(2,div+1):
		if(div%i==0):
			factor.append(i)
			while(div%i==0):
				div/=i
	ans=True
	#print factor
	if(len(factor)<2):
		return False
	for num in factor:
		if(checkTypeZwei(base,num)!=-1 or checkTypeDrei(base,num) or checkTypeElf(base,num)):
			ans=True
		else:
			ans=False
			break;
	return ans

def xBase(num,base):
	res=[]
	while(num):
		tmpNum=num%base
		tmpList=[]
		tmpList.append(tmpNum)
		tmpList.extend(res)
		res=tmpList
		num/=base
	return [0] if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	leng=-1
	if(type==7):
		leng=checkTypeZwei(base,div)
		if(leng!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print leng

b,d=map(int,raw_input().split())

for i in xrange(1,10):

    if (b**i)%d==0:

        print "2-type"

        print i

        exit()

if (b-1)%d==0:

    print "3-type"

elif (b+1)%d==0:

    print "11-type"

else:

    for i in xrange(2,d+1):

        if d%i==0:

            x=1

            while d%i==0: d/=i; x*=i

            if (b**10)%x!=0 and (b+1)%x!=0 and (b-1)%x!=0:

                print "7-type"

                exit()

    print "6-type"

# Made By Mostafa_Khaled

import sys

b, d = [int(s) for s in sys.stdin.readline().split(' ')]

def pf(d):
    l = []
    i = 2
    while i * i <= d:
        if d % i == 0:
            k = 1
            while d % i == 0:
                d /= i
                k *= i
            l.append(k)
        i += 1
    if d > 1:
        l.append(d)
    return l

def typ(b, d):
    if (b ** 7) % d == 0:
        i, bb = 1, b
        while bb % d != 0:
            i, bb = i + 1, bb * b
        return (2, i)
    elif (b - 1) % d == 0:
        return 3
    elif (b + 1) % d == 0:
        return 11
    else:
        p = pf(d)
        if p != [d] and all(typ(b, f) != 7 for f in p):
            return 6
        else:
            return 7

t=typ(b,d)
if isinstance(t, int):
    print "%d-type" % t
else:
    print "%d-type" % t[0]
    print t[1]

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(100):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      p = []
      for i in range(2, 100):
            cur = 1
            while x % i == 0:
                  cur *= i
                  x /= i
            if cur != 1:
                  p.append(cur);
      a = []
      for i in range(len(p)):
            if typeTwo(p[i]): a.append(2)
            if typeThree(p[i]): a.append(3)
            if typeEleven(p[i]): a.append(11);
      return a

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
else:
      a = typeSix(d)
      if a.count(2) <= 1 and a.count(3) <= 1 and a.count(11) <= 1 and len(a) > 0:
            print '6-type'
      else:
            print '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(50):
            if (b ** (2 * i) - 1) % d != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % d != 0:
                  return False
      return True

def typeSix(x):
      if typeTwo(x) or typeThree(x) or typeEleven(x):
            return True
      for i in range(2, x):
            if x % i == 0:
                  if typeSix(i) and typeSix(x // i):
                        return True
      return False

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
elif typeSix(d):
      print '6-type'
else:
      print '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(100):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      p = []
      for i in range(2, 100):
            while x % i == 0:
                  p.append(i);
                  x /= i
      a = []
      for i in range(len(p)):
            if typeTwo(p[i]): a.append(2)
            if typeThree(p[i]): a.append(3)
            if typeEleven(p[i]): a.append(11);
      return a

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
else:
      a = typeSix(d)
      if a.count(2) <= 1 and a.count(3) <= 1 and a.count(11) <= 1:
            print '6-type'
      else:
            print '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(50):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      if typeTwo(x) or typeThree(x) or typeEleven(x):
            return True
      for i in range(2, x):
            if x % i == 0:
                  if typeSix(i) and typeSix(x // i):
                        return True
      return False

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
elif typeSix(d):
      print '6-type'
else:
      print '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(100):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      if typeTwo(x):
            return [2]
      if typeThree(x):
            return [3]
      if typeEleven(x):
            return [11]
      for i in range(2, x):
            if x % i == 0:
                  a = []
                  a.extend(typeSix(i))
                  a.extend(typeSix(x // i))
                  if a.count(2) <= 1 and a.count(3) <= 1 and a.count(11) <= 1:
                        return a
      return [2, 2]

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
else:
      a = typeSix(d)
      if a.count(2) <= 1 and a.count(3) <= 1 and a.count(11) <= 1:
            print '6-type'
      else:
            print '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(50):
            if (b ** (2 * i) - 1) % d != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % d != 0:
                  return False
      return True

def typeSix(x):
      if typeTwo(x) or typeThree(x):
            return True
      for i in range(2, x):
            if x % i == 0:
                  if typeSix(i) and typeSix(x // i):
                        return True
      return False

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
elif typeSix(d):
      print '6-type'
else:
      print '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(100):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      p = []
      for i in range(2, 100):
            cur = 1
            while x % i == 0:
                  cur *= i
                  x /= i
            if cur != 1:
                  p.append(cur)
      a = []
      for i in range(len(p)):
            if typeTwo(p[i]): a.append(2)
            elif typeThree(p[i]): a.append(3)
            elif typeEleven(p[i]): a.append(11)
            else:
                  a.append(p[i])
      return a

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
else:
      a = typeSix(d)
      f = True
      if not(a.count(2) <= 1 and a.count(3) <= 1 and a.count(11) <= 1 and len(a) > 0):
            f = False
      if a.count(2) == 1: a.remove(2)
      if a.count(3) == 1: a.remove(3)
      if a.count(11) == 1: a.remove(11)
      if len(a) > 0:
            f = False
      print '6-type' if f else '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(100):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      p = []
      for i in range(2, 100):
            while x % i == 0:
                  p.append(i);
                  x /= i
      a = []
      for i in range(len(p)):
            if typeTwo(p[i]): a.append(2)
            if typeThree(p[i]): a.append(3)
            if typeEleven(p[i]): a.append(11);
      return a

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
else:
      a = typeSix(d)
      if a.count(2) <= 1 and a.count(3) <= 1 and a.count(11) <= 1 and len(a) > 0:
            print '6-type'
      else:
            print '7-type'

b, d = map(int, raw_input().split())

def typeTwo(x):
      for i in range(100):
            if (b ** i) % x == 0:
                  return i
      return 0

def typeThree(x):
      for i in range(100):
            if (b ** i - 1) % x != 0:
                  return False
      return True

def typeEleven(x):
      for i in range(100):
            if (b ** (2 * i) - 1) % x != 0:
                  return False
            if (b ** (2 * i + 1) + 1) % x != 0:
                  return False
      return True

def typeSix(x):
      p = []
      for i in range(2, 100):
            cur = 1
            while x % i == 0:
                  cur *= i
                  x /= i
            if cur != 1 and b % i:
                  p.append(cur)
      a = []
      for i in range(len(p)):
            if typeTwo(p[i]): a.append(2)
            elif typeThree(p[i]): a.append(3)
            elif typeEleven(p[i]): a.append(11)
            else:
                  a.append(p[i])
      return a

if typeTwo(d):
      print '2-type'
      print typeTwo(d)
elif typeThree(d):
      print '3-type'
elif typeEleven(d):
      print '11-type'
else:
      a = typeSix(d)
      f = True
      if not(a.count(2) <= 1 and a.count(3) <= 1 and a.count(11) <= 1 and len(a) > 0):
            f = False
      if a.count(2) == 1: a.remove(2)
      if a.count(3) == 1: a.remove(3)
      if a.count(11) == 1: a.remove(11)
      if len(a) > 0:
            f = False
      print '6-type' if f else '7-type'

b,d=map(int,raw_input().split())
for i in xrange(1,10):
    if (b**i)%d==0:
        print "2-type"
        print i
        exit()
if (b-1)%d==0:
    print "3-type"
elif (b+1)%d==0:
    print "11-type"
elif ((b-1)*b*(b+1))**10 % d == 0:
    print "6-type"
else:
    print "7-type"

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ch
		if(sum%div!=0):
			print sum,div
			return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ch
			else:
				eve+=ch
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def checkTypeSechs(base,div):
	factor=[]
	for i in xrange(2,div+1):
		if(div%i==0):
			factor.append(i)
			while(div%i==0):
				div/=i
	ans=True
	#print factor
	if(len(factor)<2):
		return False
	for num in factor:
		if(checkTypeZwei(base,num)!=-1 or checkTypeDrei(base,num) or checkTypeElf(base,num)):
			ans=True
		else:
			ans=False
			break;
	return ans

def xBase(num,base):
	res=[]
	while(num):
		tmpNum=num%base
		tmpList=[]
		tmpList.append(tmpNum)
		tmpList.extend(res)
		res=tmpList
		num/=base
	return [0] if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	leng=-1
	if(type==7):
		leng=checkTypeZwei(base,div)
		if(leng!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print leng

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ord(ch)-ord('0')
		if(sum%div!=0): return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		for ch in num:
			if(ind&1):
				odd+=ord(ch)-ord('0')
			else:
				eve+ord(ch)-ord('0')
			ind+=1

		if(odd!=eve):
			return False

	return True

def checkTypeSechs(base,div):
	for i in xrange(1,int(sqrt(div))):
		if(div%i==0):
			a=div/i
			b=i

			if(checkTypeZwei(base,a)!=-1 or checkTypeDrei(base,a) or checkTypeElf(base,a)):
				a=True
			else:
				a=False

			if(checkTypeZwei(base,b)!=-1 or checkTypeDrei(base,b) or checkTypeElf(base,b)):
				b=True
			else:
				b=False

			if(not (a and b)):
				return False

	return True

def xBase(num,base):
	res=''
	while(num):
		res=str(num%base)+res
		num/=base
	return '0' if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	len=-1
	if(type==7):
		len=checkTypeZwei(base,div)
		if(len!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print len

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ord(ch)-ord('0')
		if(sum%div!=0): return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ord(ch)-ord('0')
			else:
				eve+=ord(ch)-ord('0')
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def checkTypeSechs(base,div):
	factor=[]
	for i in xrange(2,div+1):
		if(div%i==0):
			factor.append(i)
			while(div%i==0):
				div/=i
	ans=True
	for num in factor:
		if(checkTypeZwei(base,num)!=-1 or checkTypeDrei(base,num) or checkTypeElf(base,num)):
			ans=True
		else:
			ans=False
			break;
	return ans

def xBase(num,base):
	res=''
	while(num):
		res=str(num%base)+res
		num/=base
	return '0' if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	len=-1
	if(type==7):
		len=checkTypeZwei(base,div)
		if(len!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print len

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ord(ch)-ord('0')
		if(sum%div!=0): return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ord(ch)-ord('0')
			else:
				eve+=ord(ch)-ord('0')
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def checkTypeSechs(base,div):
	factor=[]
	for i in xrange(2,div+1):
		if(div%i==0):
			factor.append(i)
			while(div%i==0):
				div/=i
	ans=True
	#print factor
	if(len(factor)<2):
		return False
	for num in factor:
		if(checkTypeZwei(base,num)!=-1 or checkTypeDrei(base,num) or checkTypeElf(base,num)):
			ans=True
		else:
			ans=False
			break;
	return ans

def xBase(num,base):
	res=''
	while(num):
		res=str(num%base)+res
		num/=base
	return '0' if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	leng=-1
	if(type==7):
		leng=checkTypeZwei(base,div)
		if(leng!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print leng

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ord(ch)-ord('0')
		if(sum%div!=0): return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ord(ch)-ord('0')
			else:
				eve+=ord(ch)-ord('0')
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def checkTypeSechs(base,div):
	for i in xrange(1,int(sqrt(div))):
		if(div%i==0):
			a=div/i
			b=i

			if(checkTypeZwei(base,a)!=-1 or checkTypeDrei(base,a) or checkTypeElf(base,a)):
				a=True
			else:
				a=False

			if(checkTypeZwei(base,b)!=-1 or checkTypeDrei(base,b) or checkTypeElf(base,b)):
				b=True
			else:
				b=False

			if(not (a and b)):
				return False

	return True

def xBase(num,base):
	res=''
	while(num):
		res=str(num%base)+res
		num/=base
	return '0' if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	len=-1
	if(type==7):
		len=checkTypeZwei(base,div)
		if(len!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print len

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ord(ch)-ord('0')
		if(sum%div!=0): return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ord(ch)-ord('0')
			else:
				eve+=ord(ch)-ord('0')
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def checkTypeSechs(base,div):
	for i in xrange(1,int(sqrt(div))+1):
		if(div%i==0):
			a=div/i
			b=i
			#print a,b
			if(checkTypeZwei(base,a)!=-1 or checkTypeDrei(base,a) or checkTypeElf(base,a)):
				a=True
			else:
				a=False

			if(checkTypeZwei(base,b)!=-1 or checkTypeDrei(base,b) or checkTypeElf(base,b)):
				b=True
			else:
				b=False

			if(a and b):
				return True

	return False

def xBase(num,base):
	res=''
	while(num):
		res=str(num%base)+res
		num/=base
	return '0' if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	len=-1
	if(type==7):
		len=checkTypeZwei(base,div)
		if(len!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print len

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ord(ch)-ord('0')
		if(sum%div!=0): return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ord(ch)-ord('0')
			else:
				eve+=ord(ch)-ord('0')
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def gcd(a,b):
	if(b>a):
		return gcd(a,b)
	elif(a%b==0):
		return b
	else:
		return gcd(b,a%b)

def checkTypeSechs(base,div):
	factor=[]
	for i in xrange(2,int(sqrt(div))+1):
		if(div%i==0):
			factor.append(i)
			while(div%i==0):
				div/=i
	ans=True
	for num in factor:
		if(checkTypeZwei(base,num)!=-1 or checkTypeDrei(base,num) or checkTypeElf(base,num)):
			ans=True
		else:
			ans=False
			break;
	return ans

def xBase(num,base):
	res=''
	while(num):
		res=str(num%base)+res
		num/=base
	return '0' if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	len=-1
	if(type==7):
		len=checkTypeZwei(base,div)
		if(len!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print len

import sys
from random import randint
from math import sqrt

mul=[]
rand=[]
SIZE = 32

def checkTypeZwei(base,div):
	for i in xrange(SIZE):
		if(int(mul[i])%div==0):
			return i
	return -1

def checkTypeDrei(base,div):
	for num in rand:
		sum=0
		for ch in num:
			sum+=ord(ch)-ord('0')
		if(sum%div!=0): return False

	return True

def checkTypeElf(base,div):
	for i in xrange(SIZE):
		num=rand[i]
		eve=0
		odd=0
		ind=0
		num=num[::-1]
		for ch in num:
			if(ind&1):
				odd+=ord(ch)-ord('0')
			else:
				eve+=ord(ch)-ord('0')
			ind+=1

		if(odd!=eve and abs(odd-eve)%div!=0 ):
			return False

	return True

def gcd(a,b):
	if(b>a):
		return gcd(a,b)
	elif(a%b==0):
		return b
	else:
		return gcd(b,a%b)

def checkTypeSechs(base,div):
	for i in xrange(1,int(sqrt(div))+1):
		if(div%i==0):
			a=div/i
			b=i
			if(gcd(a,b)!=1):
				continue
			if(checkTypeZwei(base,a)!=-1 or checkTypeDrei(base,a) or checkTypeElf(base,a)):
				a=True
			else:
				a=False

			if(checkTypeZwei(base,b)!=-1 or checkTypeDrei(base,b) or checkTypeElf(base,b)):
				b=True
			else:
				b=False

			if(a and b):
				return True

	return False

def xBase(num,base):
	res=''
	while(num):
		res=str(num%base)+res
		num/=base
	return '0' if(res=='') else res

if(__name__=='__main__'):

	instr=raw_input()
	instr=instr.split()
	base=int(instr[0])
	div=int(instr[1])

	for i in xrange(SIZE):
		mul.append(str(base**i))

	for i in xrange(SIZE):
		num=randint(0,1<<16)
		num*=div
		#print xBase(num,base)
		rand.append(xBase(num,base))
	type=7
	len=-1
	if(type==7):
		len=checkTypeZwei(base,div)
		if(len!=-1):
			type=2

	if(type==7):
		if(checkTypeDrei(base,div)):
			type=3

	if(type==7):
		if(checkTypeElf(base,div)):
			type=11

	if(type==7):
		if(checkTypeSechs(base,div)):
			type=6

	print(str(type)+'-type')
	if(type==2):
		print len

import sys

b, d = [int(s) for s in sys.stdin.readline().split(' ')]

def pf(d):
    l = []
    i = 2
    while i * i <= d:
        if d % i == 0:
            while d % i == 0: d /= i
            l.append(i)
        i += 1
    if d > 1:
        l.append(d)
    return l

def typ(b, d):
    if (b ** 7) % d == 0:
        i, bb = 1, b
        while bb % d != 0:
            i, bb = i + 1, bb * b
        return (2, i)
    elif (b - 1) % d == 0:
        return 3
    elif (b + 1) % d == 0:
        return 11
    else:
        p = pf(d)
        if p != [d] and all(typ(b, f) != 7 for f in p):
            return 6
        else:
            return 7

t=typ(b,d)
if isinstance(t, int):
    print "%d-type" % t
else:
    print "%d-type" % t[0]
    print t[1]

import sys

b, d = [int(s) for s in sys.stdin.readline().split(' ')]

def pf(d):
    l = []
    i = 2
    while i * i <= d:
        if d % i == 0:
            while d % i == 0: d /= i
            l.append(i)
        i += 1
    if i > 1:
        l.append(i)
    return l

def typ(b, d):
    if (b ** 7) % d == 0:
        i, bb = 1, b
        while bb % d != 0:
            i, bb = i + 1, bb * b
        return (2, i)
    elif (b - 1) % d == 0:
        return 3
    elif (b + 1) % d == 0:
        return 11
    else:
        p = pf(d)
        if p and all(typ(b, f) != 7 for f in p):
            return 6
        else:
            return 7

t=typ(b,d)
if isinstance(t, int):
    print "%d-type" % t
else:
    print "%d-type" % t[0]
    print t[1]


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

class FFT:
    def __init__(self, MOD=998244353):
        FFT.MOD = MOD
        g = self.primitive_root_constexpr()
        ig = pow(g, FFT.MOD - 2, FFT.MOD)
        FFT.W = [pow(g, (FFT.MOD - 1) >> i, FFT.MOD) for i in range(30)]
        FFT.iW = [pow(ig, (FFT.MOD - 1) >> i, FFT.MOD) for i in range(30)]

    def primitive_root_constexpr(self):
        if FFT.MOD == 998244353:
            return 3
        elif FFT.MOD == 200003:
            return 2
        elif FFT.MOD == 167772161:
            return 3
        elif FFT.MOD == 469762049:
            return 3
        elif FFT.MOD == 754974721:
            return 11
        divs = [0] * 20
        divs[0] = 2
        cnt = 1
        x = (FFT.MOD - 1) // 2
        while x % 2 == 0:
            x //= 2
        i = 3
        while i * i <= x:
            if x % i == 0:
                divs[cnt] = i
                cnt += 1
                while x % i == 0:
                    x //= i
            i += 2
        if x > 1:
            divs[cnt] = x
            cnt += 1
        g = 2
        while 1:
            ok = True
            for i in range(cnt):
                if pow(g, (FFT.MOD - 1) // divs[i], FFT.MOD) == 1:
                    ok = False
                    break
            if ok:
                return g
            g += 1

    def fft(self, k, f):
        for l in range(k, 0, -1):
            d = 1 << l - 1
            U = [1]
            for i in range(d):
                U.append(U[-1] * FFT.W[l] % FFT.MOD)

            for i in range(1 << k - l):
                for j in range(d):
                    s = i * 2 * d + j
                    f[s], f[s + d] = (f[s] + f[s + d]) % FFT.MOD, U[j] * (f[s] - f[s + d]) % FFT.MOD

    def ifft(self, k, f):
        for l in range(1, k + 1):
            d = 1 << l - 1
            for i in range(1 << k - l):
                u = 1
                for j in range(i * 2 * d, (i * 2 + 1) * d):
                    f[j+d] *= u
                    f[j], f[j + d] = (f[j] + f[j + d]) % FFT.MOD, (f[j] - f[j + d]) % FFT.MOD
                    u = u * FFT.iW[l] % FFT.MOD

    def convolve(self, A, B):
        n0 = len(A) + len(B) - 1
        k = (n0).bit_length()
        n = 1 << k
        A += [0] * (n - len(A))
        B += [0] * (n - len(B))
        self.fft(k, A)
        self.fft(k, B)
        A = [a * b % FFT.MOD for a, b in zip(A, B)]
        self.ifft(k, A)
        inv = pow(n, FFT.MOD - 2, FFT.MOD)
        A = [a * inv % FFT.MOD for a in A]
        del A[n0:]
        return A

MOD = 998244353
def solve():
    n, k, f = map(int, input().split())
    if f > 2 * k:
        print(0)
        return

    fft = FFT()
    A = [1] * (k + 1)
    for i in range(n):
        B = fft.convolve(A[:], A[:])
        if i == n - 1:
            break
        tot = sum(B[k+1:]) % MOD
        A = [0] * (k + 1)
        cum = 0
        for i in range(k, -1, -1):
            A[i] += tot + B[i] * (k + 1 - i)
            A[i] %= MOD
            tot += B[i]
            if tot >= 0:
                tot -= MOD
    print(B[f])

for _ in range(1):
    solve()