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

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

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

a = A("a")
f = B("f")
l = C("l")
e = A("e")
h = C("h")
k = C("k")
b = A("b")
c = B("c")
i = C("i")

a.t = l
f.x = a
l.u = i
l.r = i
l.x = a
e.t = l
h.u = i
h.r = k
h.x = e
k.u = h
k.r = l
k.x = b
b.t = l
c.x = a
i.u = h
i.r = l
i.x = e
assert f.x.t.x.t.x.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
l = C("l")
e = A("e")
h = C("h")
k = C("k")
b = A("b")
c = B("c")
i = C("i")

a.t = l
f.x = a
l.u = i
l.r = i
l.x = a
e.t = l
h.u = i
h.r = k
h.x = e
k.u = h
k.r = l
k.x = b
b.t = l
c.x = a
i.u = h
i.r = l
i.x = e
assert f.x.t.x.t.x.t.r.txt == "i"