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

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

a = A("a")
c = B("c")
m = A("m")
l = A("l")
f = A("f")
i = A("i")
b = B("b")

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

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

a = A("a")
c = B("c")
m = A("m")
l = A("l")
f = A("f")
i = A("i")
b = B("b")

a.t = b
c.v = b
c.y = f
m.t = c
l.t = c
f.t = c
i.t = c
b.v = c
b.y = a
assert i.t.v.y.t.v.v.txt == "b"