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

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

e = A("e")
j = B("j")
l = B("l")
b = A("b")

e.v = b
e.t = b
j.s = b
j.u = l
l.s = b
l.u = j
b.v = e
b.t = e
assert j.u.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: A = None
        self.txt = txt

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

e = A("e")
j = B("j")
l = B("l")
b = A("b")

e.v = b
e.t = b
j.s = b
j.u = l
l.s = b
l.u = j
b.v = e
b.t = e
assert j.u.s.t.txt == "e"