class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: B = None
        self.z: E = None
        self.w: E = None
        self.txt = txt

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

d = A("d")
l = B("l")
n = C("n")
f = D("f")
g = E("g")
j = A("j")
a = A("a")

d.o = f
d.w = f
d.r = g
l.u = f
l.w = a
l.o = j
n.w = f
n.q = f
n.r = j
f.v = d
f.u = l
f.z = g
f.w = g
g.v = a
g.o = a
g.r = l
g.q = f
j.o = f
j.w = f
j.r = g
a.o = f
a.w = f
a.r = g
assert l.u.z.r.u.w.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: B = None
        self.z: E = None
        self.w: E = None
        self.txt = txt

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

d = A("d")
l = B("l")
n = C("n")
f = D("f")
g = E("g")
j = A("j")
a = A("a")

d.o = f
d.w = f
d.r = g
l.u = f
l.w = a
l.o = j
n.w = f
n.q = f
n.r = j
f.v = d
f.u = l
f.z = g
f.w = g
g.v = a
g.o = a
g.r = l
g.q = f
j.o = f
j.w = f
j.r = g
a.o = f
a.w = f
a.r = g
assert l.u.z.r.u.w.q.z.txt == "g"