class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.o: D = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: C = None
        self.w: C = None
        self.u: E = None
        self.txt = txt

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

g = A("g")
m = B("m")
h = C("h")
j = D("j")
k = E("k")
e = A("e")
f = E("f")

g.y = j
g.o = j
g.z = f
g.q = h
m.u = h
m.v = h
m.t = h
m.y = j
h.u = m
j.s = f
j.t = h
j.w = h
j.u = k
k.s = m
k.y = f
e.y = j
e.o = j
e.z = k
e.q = h
f.s = m
f.y = k
assert m.y.u.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.o: D = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: C = None
        self.w: C = None
        self.u: E = None
        self.txt = txt

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

g = A("g")
m = B("m")
h = C("h")
j = D("j")
k = E("k")
e = A("e")
f = E("f")

g.y = j
g.o = j
g.z = f
g.q = h
m.u = h
m.v = h
m.t = h
m.y = j
h.u = m
j.s = f
j.t = h
j.w = h
j.u = k
k.s = m
k.y = f
e.y = j
e.o = j
e.z = k
e.q = h
f.s = m
f.y = k
assert m.y.u.s.v.txt == "h"