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

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

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

b = A("b")
n = B("n")
a = C("a")
k = C("k")
m = A("m")
c = A("c")

b.x = k
n.y = a
n.t = a
n.u = m
a.y = n
a.s = n
a.q = k
k.y = n
k.s = n
k.q = a
m.x = k
c.x = a
assert k.y.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
a = C("a")
k = C("k")
m = A("m")
c = A("c")

b.x = k
n.y = a
n.t = a
n.u = m
a.y = n
a.s = n
a.q = k
k.y = n
k.s = n
k.q = a
m.x = k
c.x = a
assert k.y.t.q.y.txt == "n"