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

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

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

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

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

g.o = a
g.s = l
b.t = g
n.v = e
n.z = g
c.y = n
c.o = l
c.x = b
c.u = b
a.v = e
a.z = g
k.y = n
k.o = c
k.x = b
k.u = e
l.y = a
l.o = k
l.x = e
l.u = b
e.t = g
assert n.z.o.v.t.o.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: D = None
        self.txt = txt

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

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

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

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

g.o = a
g.s = l
b.t = g
n.v = e
n.z = g
c.y = n
c.o = l
c.x = b
c.u = b
a.v = e
a.z = g
k.y = n
k.o = c
k.x = b
k.u = e
l.y = a
l.o = k
l.x = e
l.u = b
e.t = g
assert n.z.o.v.t.o.v.t.txt == "g"