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

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

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

l = A("l")
h = B("h")
k = C("k")
c = A("c")
n = A("n")
j = A("j")
i = C("i")
d = A("d")

l.r = i
h.o = k
k.t = j
k.u = h
c.r = k
n.r = k
j.r = i
i.t = n
i.u = h
d.r = k
assert k.u.o.t.r.t.r.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
k = C("k")
c = A("c")
n = A("n")
j = A("j")
i = C("i")
d = A("d")

l.r = i
h.o = k
k.t = j
k.u = h
c.r = k
n.r = k
j.r = i
i.t = n
i.u = h
d.r = k
assert k.u.o.t.r.t.r.u.o.txt == "k"