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

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

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

b = A("b")
n = B("n")
l = C("l")
a = B("a")
c = A("c")
e = C("e")
d = B("d")

b.x = c
n.o = c
n.p = c
l.z = e
l.s = e
l.r = a
a.o = b
a.p = b
c.x = b
e.z = l
e.s = l
e.r = n
d.o = b
d.p = b
assert e.s.r.p.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
l = C("l")
a = B("a")
c = A("c")
e = C("e")
d = B("d")

b.x = c
n.o = c
n.p = c
l.z = e
l.s = e
l.r = a
a.o = b
a.p = b
c.x = b
e.z = l
e.s = l
e.r = n
d.o = b
d.p = b
assert e.s.r.p.x.x.x.txt == "c"