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

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

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

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

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

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

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