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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: B = None
        self.y: D = None
        self.s: B = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
j = C("j")
k = D("k")
f = C("f")
g = A("g")
b = B("b")
a = D("a")
l = B("l")
m = B("m")

c.w = j
c.r = a
c.o = k
e.z = j
e.x = m
e.y = a
e.s = l
j.q = a
k.o = g
f.q = a
g.w = j
g.r = k
g.o = k
b.z = f
b.x = m
b.y = a
b.s = e
a.o = c
l.z = j
l.x = m
l.s = m
l.y = a
m.z = j
m.x = e
m.y = a
m.s = l
assert l.y.o.o.o.o.o.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: D = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: B = None
        self.y: D = None
        self.s: B = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
j = C("j")
k = D("k")
f = C("f")
g = A("g")
b = B("b")
a = D("a")
l = B("l")
m = B("m")

c.w = j
c.r = a
c.o = k
e.z = j
e.x = m
e.y = a
e.s = l
j.q = a
k.o = g
f.q = a
g.w = j
g.r = k
g.o = k
b.z = f
b.x = m
b.y = a
b.s = e
a.o = c
l.z = j
l.x = m
l.s = m
l.y = a
m.z = j
m.x = e
m.y = a
m.s = l
assert l.y.o.o.o.o.o.w.q.txt == "a"