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

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

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

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

e.s = l
e.r = i
e.q = n
n.o = a
n.q = k
l.s = a
l.u = i
a.s = l
a.u = i
f.o = l
f.q = k
k.o = a
k.q = f
i.s = a
i.r = e
i.q = k
assert e.r.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: A = None
        self.q: B = None
        self.txt = txt

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

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

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

e.s = l
e.r = i
e.q = n
n.o = a
n.q = k
l.s = a
l.u = i
a.s = l
a.u = i
f.o = l
f.q = k
k.o = a
k.q = f
i.s = a
i.r = e
i.q = k
assert e.r.r.s.txt == "l"