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

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

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

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

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

h.t = n
h.z = f
h.r = e
h.q = a
a.q = m
f.q = h
m.u = j
m.t = f
m.z = f
m.v = f
d.q = m
n.t = c
n.z = f
n.r = a
n.q = a
c.t = n
c.z = f
c.r = i
c.q = a
e.q = m
j.u = m
j.t = f
j.z = f
j.v = f
i.q = m
assert c.q.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: C = None
        self.r: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

h.t = n
h.z = f
h.r = e
h.q = a
a.q = m
f.q = h
m.u = j
m.t = f
m.z = f
m.v = f
d.q = m
n.t = c
n.z = f
n.r = a
n.q = a
c.t = n
c.z = f
c.r = i
c.q = a
e.q = m
j.u = m
j.t = f
j.z = f
j.v = f
i.q = m
assert c.q.q.u.txt == "j"