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

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

j = A("j")
h = B("h")
d = A("d")
n = A("n")
i = A("i")
k = B("k")

j.y = k
h.o = k
d.y = h
n.y = k
i.y = h
k.o = h
assert k.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

j = A("j")
h = B("h")
d = A("d")
n = A("n")
i = A("i")
k = B("k")

j.y = k
h.o = k
d.y = h
n.y = k
i.y = h
k.o = h
assert k.o.o.o.o.txt == "k"