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

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

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

i = A("i")
m = B("m")
h = C("h")
d = B("d")
a = B("a")
e = C("e")
k = C("k")

i.u = e
i.s = e
i.r = e
m.r = i
m.u = i
h.p = k
h.t = a
h.s = i
d.r = i
d.u = i
a.r = i
a.u = i
e.p = h
e.t = m
e.s = i
k.p = h
k.t = a
k.s = i
assert d.u.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

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

i = A("i")
m = B("m")
h = C("h")
d = B("d")
a = B("a")
e = C("e")
k = C("k")

i.u = e
i.s = e
i.r = e
m.r = i
m.u = i
h.p = k
h.t = a
h.s = i
d.r = i
d.u = i
a.r = i
a.u = i
e.p = h
e.t = m
e.s = i
k.p = h
k.t = a
k.s = i
assert d.u.u.t.u.txt == "i"