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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

j = A("j")
g = B("g")
a = C("a")
b = D("b")
d = C("d")
e = B("e")
n = B("n")
k = B("k")
i = B("i")

j.q = b
j.t = b
j.v = b
g.q = j
g.o = j
g.p = i
g.x = a
a.z = i
a.q = j
a.s = j
b.x = j
d.z = n
d.q = j
d.s = j
e.q = j
e.o = j
e.p = i
e.x = a
n.q = j
n.o = j
n.p = i
n.x = d
k.q = j
k.o = j
k.p = g
k.x = d
i.q = j
i.o = j
i.p = k
i.x = a
assert i.x.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: D = None
        self.v: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

j = A("j")
g = B("g")
a = C("a")
b = D("b")
d = C("d")
e = B("e")
n = B("n")
k = B("k")
i = B("i")

j.q = b
j.t = b
j.v = b
g.q = j
g.o = j
g.p = i
g.x = a
a.z = i
a.q = j
a.s = j
b.x = j
d.z = n
d.q = j
d.s = j
e.q = j
e.o = j
e.p = i
e.x = a
n.q = j
n.o = j
n.p = i
n.x = d
k.q = j
k.o = j
k.p = g
k.x = d
i.q = j
i.o = j
i.p = k
i.x = a
assert i.x.z.q.txt == "j"