class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: B = None
        self.txt = txt

f = A("f")
i = B("i")
n = A("n")
c = A("c")
k = A("k")
b = B("b")
m = A("m")
h = A("h")
d = A("d")

f.x = d
f.t = i
i.s = b
i.z = b
n.x = m
n.t = i
c.x = f
c.t = b
k.x = n
k.t = b
b.s = i
b.z = i
m.x = k
m.t = b
h.x = d
h.t = i
d.x = f
d.t = b
assert b.s.z.s.z.z.z.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: B = None
        self.txt = txt

f = A("f")
i = B("i")
n = A("n")
c = A("c")
k = A("k")
b = B("b")
m = A("m")
h = A("h")
d = A("d")

f.x = d
f.t = i
i.s = b
i.z = b
n.x = m
n.t = i
c.x = f
c.t = b
k.x = n
k.t = b
b.s = i
b.z = i
m.x = k
m.t = b
h.x = d
h.t = i
d.x = f
d.t = b
assert b.s.z.s.z.z.z.s.s.txt == "b"