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

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

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

a = A("a")
n = B("n")
g = C("g")
e = B("e")
m = C("m")
f = C("f")
k = C("k")
l = A("l")
b = C("b")
i = B("i")

a.z = i
a.u = l
a.y = f
n.q = i
n.x = i
g.t = e
e.q = i
e.x = i
m.t = i
f.t = i
k.t = n
l.z = e
l.u = a
l.y = f
b.t = i
i.q = n
i.x = n
assert k.t.x.q.q.x.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: A = None
        self.y: C = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
g = C("g")
e = B("e")
m = C("m")
f = C("f")
k = C("k")
l = A("l")
b = C("b")
i = B("i")

a.z = i
a.u = l
a.y = f
n.q = i
n.x = i
g.t = e
e.q = i
e.x = i
m.t = i
f.t = i
k.t = n
l.z = e
l.u = a
l.y = f
b.t = i
i.q = n
i.x = n
assert k.t.x.q.q.x.x.q.txt == "n"