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

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

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

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

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

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

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

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

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

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

j.q = a
j.y = b
j.x = k
d.w = a
d.q = a
a.w = e
f.w = a
f.o = a
f.z = m
f.v = l
l.w = a
l.q = a
e.w = a
e.o = a
e.z = m
e.v = d
m.w = a
m.o = a
m.z = f
m.v = l
k.q = a
k.y = b
k.x = j
b.q = a
b.y = k
b.x = k
assert b.q.w.v.txt == "d"