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

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

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

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

g = A("g")
b = B("b")
d = C("d")
a = D("a")
h = C("h")
m = D("m")
e = B("e")
l = D("l")
k = C("k")

g.u = l
b.t = e
b.w = e
b.z = e
b.x = h
d.s = g
d.t = g
d.u = a
d.z = l
a.z = g
a.v = g
a.q = d
a.p = m
h.s = g
h.t = g
h.u = a
h.z = a
m.z = g
m.v = g
m.q = k
m.p = l
e.t = b
e.w = b
e.z = b
e.x = d
l.z = g
l.v = g
l.q = k
l.p = m
k.s = g
k.t = g
k.u = m
k.z = m
assert h.s.u.q.u.p.z.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

g = A("g")
b = B("b")
d = C("d")
a = D("a")
h = C("h")
m = D("m")
e = B("e")
l = D("l")
k = C("k")

g.u = l
b.t = e
b.w = e
b.z = e
b.x = h
d.s = g
d.t = g
d.u = a
d.z = l
a.z = g
a.v = g
a.q = d
a.p = m
h.s = g
h.t = g
h.u = a
h.z = a
m.z = g
m.v = g
m.q = k
m.p = l
e.t = b
e.w = b
e.z = b
e.x = d
l.z = g
l.v = g
l.q = k
l.p = m
k.s = g
k.t = g
k.u = m
k.z = m
assert h.s.u.q.u.p.z.u.v.txt == "g"