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

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

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

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

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

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

c.s = i
c.t = f
k.y = a
k.s = i
a.y = i
a.s = k
e.s = k
e.t = c
f.s = h
f.t = c
h.y = a
h.s = k
i.y = a
i.s = h
assert f.t.t.s.y.y.y.y.txt == "i"