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

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

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

j.w = e
c.t = i
l.w = j
f.t = i
e.w = j
i.w = j
assert c.t.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

j.w = e
c.t = i
l.w = j
f.t = i
e.w = j
i.w = j
assert c.t.w.w.txt == "e"