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

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

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

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

j = A("j")
g = B("g")
h = C("h")
k = D("k")
i = C("i")
f = D("f")
l = B("l")
m = A("m")

j.z = g
j.t = f
j.x = h
j.u = i
g.v = i
h.z = l
h.p = l
h.y = k
k.t = j
k.s = g
i.z = l
i.p = l
i.y = k
f.t = m
f.s = g
l.v = i
m.z = l
m.t = f
m.x = h
m.u = h
assert h.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.x: C = None
        self.u: C = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
h = C("h")
k = D("k")
i = C("i")
f = D("f")
l = B("l")
m = A("m")

j.z = g
j.t = f
j.x = h
j.u = i
g.v = i
h.z = l
h.p = l
h.y = k
k.t = j
k.s = g
i.z = l
i.p = l
i.y = k
f.t = m
f.s = g
l.v = i
m.z = l
m.t = f
m.x = h
m.u = h
assert h.z.v.z.txt == "l"