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

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

b = A("b")
c = B("c")
f = A("f")
l = A("l")

b.y = c
b.w = f
c.v = f
f.y = c
f.w = b
l.y = c
l.w = b
assert l.w.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: A = None
        self.txt = txt

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

b = A("b")
c = B("c")
f = A("f")
l = A("l")

b.y = c
b.w = f
c.v = f
f.y = c
f.w = b
l.y = c
l.w = b
assert l.w.w.y.txt == "c"