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

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

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

n = A("n")
h = B("h")
j = C("j")

n.v = h
n.u = j
n.s = j
h.u = n
j.z = n
j.w = n
j.p = n
assert n.v.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: C = None
        self.s: C = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
j = C("j")

n.v = h
n.u = j
n.s = j
h.u = n
j.z = n
j.w = n
j.p = n
assert n.v.u.u.txt == "j"