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

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

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

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

b = A("b")
c = B("c")
k = C("k")
g = D("g")
h = B("h")
e = A("e")
n = D("n")
l = C("l")
m = C("m")
i = C("i")

b.w = n
b.x = n
b.u = m
b.r = h
c.r = n
k.v = e
g.r = n
g.t = n
g.z = h
g.s = b
h.r = n
e.w = n
e.x = n
e.u = l
e.r = h
n.r = g
n.t = g
n.z = h
n.s = b
l.v = b
m.v = b
i.v = e
assert m.v.w.s.w.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: D = None
        self.u: C = None
        self.r: B = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
k = C("k")
g = D("g")
h = B("h")
e = A("e")
n = D("n")
l = C("l")
m = C("m")
i = C("i")

b.w = n
b.x = n
b.u = m
b.r = h
c.r = n
k.v = e
g.r = n
g.t = n
g.z = h
g.s = b
h.r = n
e.w = n
e.x = n
e.u = l
e.r = h
n.r = g
n.t = g
n.z = h
n.s = b
l.v = b
m.v = b
i.v = e
assert m.v.w.s.w.r.z.txt == "h"