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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.s: E = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.s: E = None
        self.u: E = None
        self.txt = txt

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

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

g.y = c
g.t = a
b.o = l
l.w = g
l.v = b
e.v = d
e.y = d
e.s = n
e.u = n
n.x = m
n.u = m
n.s = d
c.w = g
c.v = a
a.o = c
m.x = n
m.u = n
m.s = l
d.w = g
d.v = a
assert l.w.t.o.v.o.w.y.w.txt == "g"