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

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

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

j = A("j")
c = B("c")
f = C("f")
a = B("a")
k = A("k")
n = B("n")

j.p = f
j.s = f
j.u = f
c.q = k
f.y = a
a.q = k
k.p = f
k.s = f
k.u = f
n.q = k
assert j.u.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.u: C = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
f = C("f")
a = B("a")
k = A("k")
n = B("n")

j.p = f
j.s = f
j.u = f
c.q = k
f.y = a
a.q = k
k.p = f
k.s = f
k.u = f
n.q = k
assert j.u.y.q.txt == "k"