class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.o: B = None
        self.r: A = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

a.q = n
a.u = f
a.o = e
a.r = j
e.t = d
e.s = g
e.u = h
e.x = i
n.z = d
n.u = j
n.x = j
n.q = f
c.s = f
c.u = n
j.q = n
j.u = i
j.o = d
j.r = a
d.t = g
d.s = e
d.u = h
d.x = c
f.s = i
f.u = n
g.t = e
g.s = e
g.u = i
g.x = f
i.s = c
i.u = n
h.s = c
h.u = n
assert j.u.u.q.u.x.r.o.t.u.txt == "h"