class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: 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.v: B = None
        self.txt = txt

k = A("k")
a = B("a")
j = C("j")

k.p = j
k.u = j
a.s = k
a.u = j
j.v = a
assert j.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: 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.v: B = None
        self.txt = txt

k = A("k")
a = B("a")
j = C("j")

k.p = j
k.u = j
a.s = k
a.u = j
j.v = a
assert j.v.u.v.txt == "a"