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

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: E = None
        self.y: B = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: B = None
        self.s: B = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
l = C("l")
f = D("f")
h = E("h")
c = D("c")
k = E("k")
e = B("e")
d = D("d")
m = D("m")

g.o = h
n.w = e
n.y = e
n.x = k
n.t = l
l.v = m
l.y = e
l.s = e
f.o = n
f.u = e
h.z = e
c.o = n
c.u = n
k.z = n
e.w = n
e.y = n
e.x = h
e.t = l
d.o = e
d.u = n
m.o = e
m.u = e
assert f.u.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: E = None
        self.y: B = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: B = None
        self.s: B = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
l = C("l")
f = D("f")
h = E("h")
c = D("c")
k = E("k")
e = B("e")
d = D("d")
m = D("m")

g.o = h
n.w = e
n.y = e
n.x = k
n.t = l
l.v = m
l.y = e
l.s = e
f.o = n
f.u = e
h.z = e
c.o = n
c.u = n
k.z = n
e.w = n
e.y = n
e.x = h
e.t = l
d.o = e
d.u = n
m.o = e
m.u = e
assert f.u.x.z.txt == "e"