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

c = A("c")
e = B("e")
b = C("b")
k = A("k")
l = C("l")

c.v = e
c.s = e
c.w = e
e.w = c
b.p = l
k.v = e
k.s = e
k.w = e
l.p = b
assert b.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.w: 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.p: C = None
        self.txt = txt

c = A("c")
e = B("e")
b = C("b")
k = A("k")
l = C("l")

c.v = e
c.s = e
c.w = e
e.w = c
b.p = l
k.v = e
k.s = e
k.w = e
l.p = b
assert b.p.p.p.txt == "l"