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

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

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

n = A("n")
f = B("f")
l = C("l")
c = B("c")
e = B("e")
j = C("j")
m = A("m")
i = C("i")
h = B("h")
a = A("a")

n.r = i
n.t = i
f.x = e
l.s = m
c.x = f
e.x = h
j.s = a
m.r = i
m.t = j
i.s = n
h.x = f
a.r = l
a.t = l
assert l.s.t.s.r.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: C = None
        self.txt = txt

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

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

n = A("n")
f = B("f")
l = C("l")
c = B("c")
e = B("e")
j = C("j")
m = A("m")
i = C("i")
h = B("h")
a = A("a")

n.r = i
n.t = i
f.x = e
l.s = m
c.x = f
e.x = h
j.s = a
m.r = i
m.t = j
i.s = n
h.x = f
a.r = l
a.t = l
assert l.s.t.s.r.s.t.s.txt == "a"