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

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

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

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

g = A("g")
m = B("m")
a = C("a")
l = D("l")
j = B("j")
f = C("f")
e = C("e")

g.z = e
m.q = a
m.w = a
m.t = e
m.x = j
a.t = f
a.v = e
a.u = m
a.x = m
l.o = a
j.q = f
j.t = a
j.w = a
j.x = m
f.t = e
f.v = a
f.u = m
f.x = j
e.t = a
e.v = a
e.u = j
e.x = m
assert g.z.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
a = C("a")
l = D("l")
j = B("j")
f = C("f")
e = C("e")

g.z = e
m.q = a
m.w = a
m.t = e
m.x = j
a.t = f
a.v = e
a.u = m
a.x = m
l.o = a
j.q = f
j.t = a
j.w = a
j.x = m
f.t = e
f.v = a
f.u = m
f.x = j
e.t = a
e.v = a
e.u = j
e.x = m
assert g.z.v.x.txt == "m"