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

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

c = A("c")
k = B("k")
e = B("e")
a = A("a")
i = B("i")
d = A("d")
b = A("b")
f = A("f")
l = B("l")
h = B("h")

c.y = l
k.p = e
e.p = h
a.y = k
i.p = k
d.y = i
b.y = e
f.y = l
l.p = k
h.p = e
assert h.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

c = A("c")
k = B("k")
e = B("e")
a = A("a")
i = B("i")
d = A("d")
b = A("b")
f = A("f")
l = B("l")
h = B("h")

c.y = l
k.p = e
e.p = h
a.y = k
i.p = k
d.y = i
b.y = e
f.y = l
l.p = k
h.p = e
assert h.p.p.p.txt == "e"