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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: B = None
        self.u: E = None
        self.y: B = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

g = A("g")
c = B("c")
j = C("j")
h = D("h")
f = E("f")
b = E("b")
e = E("e")

g.q = c
g.u = c
g.o = j
c.s = b
c.o = h
j.z = f
h.x = c
h.z = c
h.y = c
h.u = f
h.p = e
f.q = c
b.q = c
e.q = c
assert c.s.q.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: B = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: B = None
        self.u: E = None
        self.y: B = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

g = A("g")
c = B("c")
j = C("j")
h = D("h")
f = E("f")
b = E("b")
e = E("e")

g.q = c
g.u = c
g.o = j
c.s = b
c.o = h
j.z = f
h.x = c
h.z = c
h.y = c
h.u = f
h.p = e
f.q = c
b.q = c
e.q = c
assert c.s.q.s.q.s.txt == "b"