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

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

c = A("c")
n = B("n")
l = A("l")
j = B("j")
g = B("g")
f = B("f")
b = A("b")
e = A("e")
a = B("a")

c.t = j
n.s = e
n.z = l
l.t = n
j.s = e
j.z = c
g.s = l
g.z = c
f.s = l
f.z = l
b.t = j
e.t = f
a.s = b
a.z = c
assert l.t.s.t.z.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

c = A("c")
n = B("n")
l = A("l")
j = B("j")
g = B("g")
f = B("f")
b = A("b")
e = A("e")
a = B("a")

c.t = j
n.s = e
n.z = l
l.t = n
j.s = e
j.z = c
g.s = l
g.z = c
f.s = l
f.z = l
b.t = j
e.t = f
a.s = b
a.z = c
assert l.t.s.t.z.t.s.t.txt == "f"