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

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

f = A("f")
e = B("e")
m = B("m")
h = A("h")
i = B("i")

f.u = i
f.t = e
e.x = h
e.t = m
m.x = h
m.t = i
h.u = i
h.t = e
i.x = h
i.t = e
assert e.t.t.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.txt = txt

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

f = A("f")
e = B("e")
m = B("m")
h = A("h")
i = B("i")

f.u = i
f.t = e
e.x = h
e.t = m
m.x = h
m.t = i
h.u = i
h.t = e
i.x = h
i.t = e
assert e.t.t.x.u.txt == "i"