class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: C = None
        self.z: D = 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.w: C = None
        self.txt = txt

h = A("h")
c = B("c")
e = C("e")
g = D("g")
j = B("j")
m = B("m")
d = A("d")
l = A("l")

h.y = g
h.z = g
h.u = e
c.r = g
e.v = h
g.w = e
j.r = g
m.r = g
d.y = g
d.z = g
d.u = e
l.y = g
l.z = g
l.u = e
assert j.r.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: C = None
        self.z: D = 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.w: C = None
        self.txt = txt

h = A("h")
c = B("c")
e = C("e")
g = D("g")
j = B("j")
m = B("m")
d = A("d")
l = A("l")

h.y = g
h.z = g
h.u = e
c.r = g
e.v = h
g.w = e
j.r = g
m.r = g
d.y = g
d.z = g
d.u = e
l.y = g
l.z = g
l.u = e
assert j.r.w.v.txt == "h"