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

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

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

h.q = j
h.o = e
e.z = m
g.z = d
g.t = j
g.w = j
g.u = c
b.u = e
b.t = e
b.z = g
c.q = j
c.o = e
m.q = j
m.o = e
d.z = g
d.t = j
d.u = h
d.w = b
k.z = m
j.u = k
j.t = e
j.z = d
assert j.t.z.o.z.q.u.z.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = 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.z: C = None
        self.t: D = None
        self.u: A = None
        self.w: D = None
        self.txt = txt

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

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

h.q = j
h.o = e
e.z = m
g.z = d
g.t = j
g.w = j
g.u = c
b.u = e
b.t = e
b.z = g
c.q = j
c.o = e
m.q = j
m.o = e
d.z = g
d.t = j
d.u = h
d.w = b
k.z = m
j.u = k
j.t = e
j.z = d
assert j.t.z.o.z.q.u.z.q.t.txt == "e"