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

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: A = None
        self.u: D = None
        self.txt = txt

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

j = A("j")
m = B("m")
c = C("c")
b = D("b")
l = E("l")
i = A("i")
d = D("d")
g = A("g")
f = A("f")
h = B("h")

j.w = d
j.q = c
m.s = l
m.x = c
m.o = f
c.y = m
c.r = m
c.u = l
c.q = j
b.t = d
b.u = d
b.x = j
l.p = h
l.s = j
l.q = d
l.x = c
i.w = d
i.q = c
d.t = b
d.u = b
d.x = g
g.w = b
g.q = c
f.w = d
f.q = c
h.s = l
h.x = c
h.o = i
assert g.w.x.q.q.q.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: A = None
        self.u: D = None
        self.txt = txt

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

j = A("j")
m = B("m")
c = C("c")
b = D("b")
l = E("l")
i = A("i")
d = D("d")
g = A("g")
f = A("f")
h = B("h")

j.w = d
j.q = c
m.s = l
m.x = c
m.o = f
c.y = m
c.r = m
c.u = l
c.q = j
b.t = d
b.u = d
b.x = j
l.p = h
l.s = j
l.q = d
l.x = c
i.w = d
i.q = c
d.t = b
d.u = b
d.x = g
g.w = b
g.q = c
f.w = d
f.q = c
h.s = l
h.x = c
h.o = i
assert g.w.x.q.q.q.y.x.txt == "c"