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

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

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

i = A("i")
c = B("c")
k = C("k")
d = C("d")

i.s = c
i.t = c
c.w = i
k.r = i
k.p = c
d.r = i
d.p = c
assert k.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
k = C("k")
d = C("d")

i.s = c
i.t = c
c.w = i
k.r = i
k.p = c
d.r = i
d.p = c
assert k.r.t.w.txt == "i"