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

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

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

n = A("n")
f = B("f")
b = C("b")
d = A("d")
g = C("g")
i = A("i")
a = B("a")
l = B("l")
e = B("e")

n.r = i
n.y = i
n.q = b
f.t = d
f.s = l
f.r = g
b.u = n
d.r = n
d.y = n
d.q = b
g.u = d
i.r = n
i.y = n
i.q = g
a.t = d
a.s = f
a.r = b
l.t = i
l.s = a
l.r = b
e.t = i
e.s = f
e.r = b
assert f.t.r.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: C = None
        self.y: A = None
        self.txt = txt

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

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

n = A("n")
f = B("f")
b = C("b")
d = A("d")
g = C("g")
i = A("i")
a = B("a")
l = B("l")
e = B("e")

n.r = i
n.y = i
n.q = b
f.t = d
f.s = l
f.r = g
b.u = n
d.r = n
d.y = n
d.q = b
g.u = d
i.r = n
i.y = n
i.q = g
a.t = d
a.s = f
a.r = b
l.t = i
l.s = a
l.r = b
e.t = i
e.s = f
e.r = b
assert f.t.r.q.u.txt == "n"