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

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

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

j = A("j")
e = B("e")
l = C("l")
h = C("h")

j.w = e
e.y = l
e.w = l
l.p = j
h.p = j
assert l.p.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

j = A("j")
e = B("e")
l = C("l")
h = C("h")

j.w = e
e.y = l
e.w = l
l.p = j
h.p = j
assert l.p.w.y.txt == "l"