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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: A = None
        self.s: C = None
        self.u: D = None
        self.x: A = None
        self.txt = txt

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

a = A("a")
c = B("c")
e = C("e")
i = D("i")
f = E("f")
g = E("g")
h = D("h")

a.z = f
c.r = a
c.u = a
c.v = f
c.o = e
e.o = g
i.o = c
i.w = a
i.x = a
i.s = e
i.u = h
f.o = c
f.y = a
g.o = c
g.y = a
h.o = c
h.w = a
h.x = a
h.s = e
h.u = i
assert a.z.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: A = None
        self.s: C = None
        self.u: D = None
        self.x: A = None
        self.txt = txt

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

a = A("a")
c = B("c")
e = C("e")
i = D("i")
f = E("f")
g = E("g")
h = D("h")

a.z = f
c.r = a
c.u = a
c.v = f
c.o = e
e.o = g
i.o = c
i.w = a
i.x = a
i.s = e
i.u = h
f.o = c
f.y = a
g.o = c
g.y = a
h.o = c
h.w = a
h.x = a
h.s = e
h.u = i
assert a.z.o.o.o.o.txt == "c"