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

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

c = A("c")
l = B("l")
b = A("b")
f = A("f")
h = B("h")
k = B("k")

c.t = l
l.s = k
b.t = l
f.t = k
h.s = l
k.s = l
assert f.t.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

c = A("c")
l = B("l")
b = A("b")
f = A("f")
h = B("h")
k = B("k")

c.t = l
l.s = k
b.t = l
f.t = k
h.s = l
k.s = l
assert f.t.s.s.s.s.txt == "k"