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

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

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

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

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

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

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

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

n.u = g
l.u = c
l.w = c
l.t = e
c.s = g
c.x = l
d.u = c
g.s = c
g.x = l
f.u = c
f.t = a
f.w = g
a.u = c
i.u = g
j.u = g
e.u = c
assert d.u.x.t.u.x.t.txt == "e"