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

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

c = A("c")
f = B("f")
m = A("m")
j = B("j")
b = A("b")
i = B("i")
l = A("l")

c.o = m
c.t = f
f.p = c
f.z = l
m.o = b
m.t = i
j.p = c
j.z = b
b.o = l
b.t = i
i.p = b
i.z = b
l.o = c
l.t = f
assert i.p.o.t.z.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: B = None
        self.txt = txt

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

c = A("c")
f = B("f")
m = A("m")
j = B("j")
b = A("b")
i = B("i")
l = A("l")

c.o = m
c.t = f
f.p = c
f.z = l
m.o = b
m.t = i
j.p = c
j.z = b
b.o = l
b.t = i
i.p = b
i.z = b
l.o = c
l.t = f
assert i.p.o.t.z.t.p.t.txt == "f"