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

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

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

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

n = A("n")
l = B("l")
m = C("m")
d = D("d")
h = D("h")
g = C("g")
f = A("f")
i = A("i")
a = B("a")

n.o = l
n.v = d
l.z = h
l.r = m
l.u = i
m.o = d
m.q = h
m.s = h
m.x = g
d.x = a
h.x = a
g.o = h
g.q = h
g.s = h
g.x = m
f.o = a
f.v = d
i.o = l
i.v = h
a.z = d
a.r = g
a.u = n
assert l.u.o.u.o.r.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.txt = txt

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

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

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

n = A("n")
l = B("l")
m = C("m")
d = D("d")
h = D("h")
g = C("g")
f = A("f")
i = A("i")
a = B("a")

n.o = l
n.v = d
l.z = h
l.r = m
l.u = i
m.o = d
m.q = h
m.s = h
m.x = g
d.x = a
h.x = a
g.o = h
g.q = h
g.s = h
g.x = m
f.o = a
f.v = d
i.o = l
i.v = h
a.z = d
a.r = g
a.u = n
assert l.u.o.u.o.r.x.x.x.txt == "g"