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

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

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

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

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

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

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

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

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

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

c.x = e
c.y = e
c.r = g
c.q = a
h.o = d
h.t = k
h.z = g
n.q = k
n.v = f
n.x = d
n.z = g
g.o = a
g.r = e
g.v = d
g.x = c
d.x = e
d.y = g
d.r = g
d.q = n
k.o = d
k.t = h
k.z = g
a.q = h
a.v = j
a.x = c
a.z = g
j.q = k
j.v = n
j.x = c
j.z = g
f.q = k
f.v = a
f.x = d
f.z = e
e.o = j
e.r = g
e.v = c
e.x = d
assert n.z.v.x.o.v.q.t.t.txt == "k"