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

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

i = A("i")
f = B("f")
e = A("e")
n = B("n")

i.u = e
f.v = n
e.u = i
n.v = f
assert i.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
e = A("e")
n = B("n")

i.u = e
f.v = n
e.u = i
n.v = f
assert i.u.u.u.u.txt == "i"