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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: E = None
        self.v: E = None
        self.z: B = None
        self.w: E = None
        self.txt = txt

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

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

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

a.y = n
a.x = g
a.q = m
f.v = d
g.p = c
g.t = m
g.v = m
g.z = f
g.w = n
d.p = m
d.x = f
d.o = c
m.o = n
m.w = f
m.x = f
m.p = d
c.p = e
c.t = m
c.w = m
c.v = n
c.z = f
l.y = n
l.x = c
l.q = m
n.o = m
n.w = f
n.x = f
n.p = d
e.p = g
e.t = n
e.v = n
e.z = f
e.w = m
assert e.t.w.v.x.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: C = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: E = None
        self.v: E = None
        self.z: B = None
        self.w: E = None
        self.txt = txt

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

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

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

a.y = n
a.x = g
a.q = m
f.v = d
g.p = c
g.t = m
g.v = m
g.z = f
g.w = n
d.p = m
d.x = f
d.o = c
m.o = n
m.w = f
m.x = f
m.p = d
c.p = e
c.t = m
c.w = m
c.v = n
c.z = f
l.y = n
l.x = c
l.q = m
n.o = m
n.w = f
n.x = f
n.p = d
e.p = g
e.t = n
e.v = n
e.z = f
e.w = m
assert e.t.w.v.x.v.x.v.txt == "d"