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

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

h = A("h")
g = B("g")
j = A("j")
e = B("e")

h.t = g
g.u = e
g.s = e
j.t = e
e.u = g
e.s = g
assert e.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

h = A("h")
g = B("g")
j = A("j")
e = B("e")

h.t = g
g.u = e
g.s = e
j.t = e
e.u = g
e.s = g
assert e.u.u.u.txt == "g"