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

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

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

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

g = A("g")
l = B("l")
a = C("a")
i = D("i")
n = C("n")
b = D("b")
j = A("j")
c = B("c")
d = A("d")

g.q = i
g.z = b
g.u = b
g.o = a
l.q = g
a.t = l
a.o = l
a.z = n
a.x = c
i.w = a
i.z = c
i.r = j
i.y = g
n.t = l
n.x = l
n.z = a
n.o = c
b.w = n
b.z = l
b.r = g
b.y = g
j.q = i
j.z = i
j.o = a
j.u = b
c.q = j
d.q = i
d.z = i
d.u = i
d.o = n
assert j.u.r.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: D = None
        self.o: C = None
        self.u: D = None
        self.txt = txt

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

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

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

g = A("g")
l = B("l")
a = C("a")
i = D("i")
n = C("n")
b = D("b")
j = A("j")
c = B("c")
d = A("d")

g.q = i
g.z = b
g.u = b
g.o = a
l.q = g
a.t = l
a.o = l
a.z = n
a.x = c
i.w = a
i.z = c
i.r = j
i.y = g
n.t = l
n.x = l
n.z = a
n.o = c
b.w = n
b.z = l
b.r = g
b.y = g
j.q = i
j.z = i
j.o = a
j.u = b
c.q = j
d.q = i
d.z = i
d.u = i
d.o = n
assert j.u.r.q.z.q.txt == "j"