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

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

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

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

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

m.r = g
m.z = l
g.v = n
g.u = l
l.v = m
l.w = m
l.r = h
j.t = m
h.r = e
h.z = d
d.v = m
d.r = h
d.w = h
k.v = m
k.r = m
k.w = h
a.t = m
n.v = g
n.u = l
e.v = g
e.u = l
assert g.v.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

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

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

m.r = g
m.z = l
g.v = n
g.u = l
l.v = m
l.w = m
l.r = h
j.t = m
h.r = e
h.z = d
d.v = m
d.r = h
d.w = h
k.v = m
k.r = m
k.w = h
a.t = m
n.v = g
n.u = l
e.v = g
e.u = l
assert g.v.u.r.txt == "h"