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

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

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

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

k = A("k")
d = B("d")
a = C("a")
m = D("m")
l = D("l")
h = C("h")
b = A("b")
j = D("j")
f = B("f")
n = A("n")

k.q = b
k.z = n
k.v = h
d.w = b
d.v = j
d.z = f
a.x = h
a.t = h
a.o = b
a.r = b
m.w = n
l.w = n
h.x = a
h.t = a
h.o = n
h.r = b
b.q = k
b.z = k
b.v = h
j.w = k
f.w = n
f.v = j
f.z = d
n.q = k
n.z = k
n.v = a
assert b.z.v.r.q.z.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: A = None
        self.v: C = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
a = C("a")
m = D("m")
l = D("l")
h = C("h")
b = A("b")
j = D("j")
f = B("f")
n = A("n")

k.q = b
k.z = n
k.v = h
d.w = b
d.v = j
d.z = f
a.x = h
a.t = h
a.o = b
a.r = b
m.w = n
l.w = n
h.x = a
h.t = a
h.o = n
h.r = b
b.q = k
b.z = k
b.v = h
j.w = k
f.w = n
f.v = j
f.z = d
n.q = k
n.z = k
n.v = a
assert b.z.v.r.q.z.q.z.txt == "n"