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

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.txt = txt

e = A("e")
b = B("b")
i = C("i")
j = C("j")

e.p = i
b.s = i
i.t = j
i.w = j
j.t = i
j.w = i
assert e.p.w.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.txt = txt

e = A("e")
b = B("b")
i = C("i")
j = C("j")

e.p = i
b.s = i
i.t = j
i.w = j
j.t = i
j.w = i
assert e.p.w.t.t.txt == "j"