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

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

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

f = A("f")
h = B("h")
e = C("e")
j = C("j")
n = A("n")
l = A("l")

f.u = j
h.t = j
h.r = l
e.t = j
j.t = e
n.u = e
l.u = e
assert h.r.u.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
e = C("e")
j = C("j")
n = A("n")
l = A("l")

f.u = j
h.t = j
h.r = l
e.t = j
j.t = e
n.u = e
l.u = e
assert h.r.u.t.t.t.txt == "j"