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

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

d = A("d")
l = B("l")
h = B("h")
k = B("k")
f = B("f")
g = A("g")
i = A("i")
j = B("j")
e = A("e")

d.y = i
l.u = g
h.u = d
k.u = g
f.u = g
g.y = d
i.y = g
j.u = e
e.y = i
assert e.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

d = A("d")
l = B("l")
h = B("h")
k = B("k")
f = B("f")
g = A("g")
i = A("i")
j = B("j")
e = A("e")

d.y = i
l.u = g
h.u = d
k.u = g
f.u = g
g.y = d
i.y = g
j.u = e
e.y = i
assert e.y.y.y.y.y.y.y.txt == "i"