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

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

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

f = A("f")
c = B("c")
g = C("g")
b = C("b")
k = B("k")
i = A("i")
n = B("n")
a = C("a")

f.p = n
f.t = g
c.s = f
c.u = a
g.q = n
g.z = n
g.u = k
b.q = k
b.u = k
b.z = c
k.s = i
k.u = g
i.p = n
i.t = g
n.s = f
n.u = a
a.q = k
a.u = k
a.z = c
assert n.s.t.u.u.z.s.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: C = None
        self.txt = txt

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

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

f = A("f")
c = B("c")
g = C("g")
b = C("b")
k = B("k")
i = A("i")
n = B("n")
a = C("a")

f.p = n
f.t = g
c.s = f
c.u = a
g.q = n
g.z = n
g.u = k
b.q = k
b.u = k
b.z = c
k.s = i
k.u = g
i.p = n
i.t = g
n.s = f
n.u = a
a.q = k
a.u = k
a.z = c
assert n.s.t.u.u.z.s.t.u.txt == "k"