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

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

a = A("a")
j = B("j")
e = B("e")
i = B("i")
c = A("c")
l = B("l")

a.v = j
a.y = l
j.w = i
e.w = i
i.w = j
c.v = l
c.y = i
l.w = e
assert e.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: B = None
        self.txt = txt

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

a = A("a")
j = B("j")
e = B("e")
i = B("i")
c = A("c")
l = B("l")

a.v = j
a.y = l
j.w = i
e.w = i
i.w = j
c.v = l
c.y = i
l.w = e
assert e.w.w.w.txt == "i"