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

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

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

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

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

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

e.s = i
i.x = k
i.y = k
b.s = i
k.x = i
k.y = i
assert k.x.y.y.txt == "i"