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

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

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

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

n = A("n")
e = B("e")
a = C("a")
l = D("l")
m = C("m")
g = B("g")
c = D("c")

n.u = a
e.v = n
e.o = g
e.p = l
e.u = l
a.q = g
a.u = n
l.u = g
l.t = c
m.q = g
m.u = n
g.v = n
g.o = e
g.p = l
g.u = c
c.u = g
c.t = l
assert c.t.t.t.t.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

n = A("n")
e = B("e")
a = C("a")
l = D("l")
m = C("m")
g = B("g")
c = D("c")

n.u = a
e.v = n
e.o = g
e.p = l
e.u = l
a.q = g
a.u = n
l.u = g
l.t = c
m.q = g
m.u = n
g.v = n
g.o = e
g.p = l
g.u = c
c.u = g
c.t = l
assert c.t.t.t.t.u.v.txt == "n"