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

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

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

k.y = f
k.u = f
f.s = i
f.o = k
i.s = f
i.o = e
e.y = f
e.u = f
assert e.y.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.txt = txt

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

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

k.y = f
k.u = f
f.s = i
f.o = k
i.s = f
i.o = e
e.y = f
e.u = f
assert e.y.s.o.txt == "e"