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

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

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

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

n.x = k
n.v = k
n.u = j
d.z = j
d.q = k
e.x = k
b.x = k
i.x = d
j.x = k
m.x = d
m.v = d
m.u = b
a.x = d
a.u = e
a.v = k
k.z = i
k.q = d
assert i.x.z.x.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: C = None
        self.v: B = None
        self.txt = txt

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

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

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

n.x = k
n.v = k
n.u = j
d.z = j
d.q = k
e.x = k
b.x = k
i.x = d
j.x = k
m.x = d
m.v = d
m.u = b
a.x = d
a.u = e
a.v = k
k.z = i
k.q = d
assert i.x.z.x.q.q.q.q.q.txt == "d"