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

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

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

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

i = A("i")
a = B("a")
c = C("c")
m = D("m")
k = C("k")
d = B("d")
h = C("h")
g = D("g")
j = D("j")
f = A("f")

i.u = g
a.z = i
c.p = m
m.w = a
m.r = i
m.t = f
m.v = k
k.p = g
d.z = i
h.p = j
g.w = a
g.r = i
g.t = f
g.v = c
j.w = d
j.r = f
j.t = i
j.v = h
f.u = m
assert k.p.t.u.v.p.w.z.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

i = A("i")
a = B("a")
c = C("c")
m = D("m")
k = C("k")
d = B("d")
h = C("h")
g = D("g")
j = D("j")
f = A("f")

i.u = g
a.z = i
c.p = m
m.w = a
m.r = i
m.t = f
m.v = k
k.p = g
d.z = i
h.p = j
g.w = a
g.r = i
g.t = f
g.v = c
j.w = d
j.r = f
j.t = i
j.v = h
f.u = m
assert k.p.t.u.v.p.w.z.u.r.txt == "i"