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

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

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

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

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

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

l.v = e
m.v = g
m.u = e
m.y = e
a.q = g
a.x = m
e.y = l
e.t = g
e.r = d
e.w = a
n.v = l
n.y = f
n.z = a
g.v = m
g.u = e
g.y = e
k.v = l
k.y = f
k.z = f
f.q = g
f.x = m
d.v = e
assert a.q.u.r.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

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

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

l.v = e
m.v = g
m.u = e
m.y = e
a.q = g
a.x = m
e.y = l
e.t = g
e.r = d
e.w = a
n.v = l
n.y = f
n.z = a
g.v = m
g.u = e
g.y = e
k.v = l
k.y = f
k.z = f
f.q = g
f.x = m
d.v = e
assert a.q.u.r.v.y.txt == "l"