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

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

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

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

e = A("e")
m = B("m")
l = C("l")
k = D("k")
j = B("j")
h = A("h")

e.u = h
e.z = k
e.y = k
e.q = k
m.q = j
m.t = k
m.z = l
l.t = h
k.q = j
k.v = l
j.q = m
j.t = k
j.z = l
h.u = e
h.z = k
h.y = k
h.q = k
assert m.z.t.u.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: D = None
        self.y: D = None
        self.q: D = None
        self.txt = txt

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

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

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

e = A("e")
m = B("m")
l = C("l")
k = D("k")
j = B("j")
h = A("h")

e.u = h
e.z = k
e.y = k
e.q = k
m.q = j
m.t = k
m.z = l
l.t = h
k.q = j
k.v = l
j.q = m
j.t = k
j.z = l
h.u = e
h.z = k
h.y = k
h.q = k
assert m.z.t.u.q.v.txt == "l"