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

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

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

l = A("l")
m = B("m")
c = C("c")
k = B("k")
f = A("f")
i = C("i")
n = B("n")
e = B("e")

l.u = k
l.p = c
m.t = c
m.o = k
c.q = f
k.t = c
k.o = m
f.u = n
f.p = c
i.q = l
n.t = c
n.o = e
e.t = i
e.o = m
assert k.t.q.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: C = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
c = C("c")
k = B("k")
f = A("f")
i = C("i")
n = B("n")
e = B("e")

l.u = k
l.p = c
m.t = c
m.o = k
c.q = f
k.t = c
k.o = m
f.u = n
f.p = c
i.q = l
n.t = c
n.o = e
e.t = i
e.o = m
assert k.t.q.u.t.txt == "c"