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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: D = None
        self.z: C = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
j = C("j")
e = D("e")
n = A("n")
f = C("f")
h = D("h")
d = D("d")
a = C("a")
b = D("b")

c.w = j
c.s = n
c.q = n
g.t = j
g.z = j
g.r = d
j.v = g
j.q = g
j.o = a
j.r = a
e.r = j
n.w = a
n.s = c
n.q = c
f.v = g
f.q = g
f.o = a
f.r = a
h.r = f
d.r = j
a.v = g
a.q = g
a.o = f
a.r = j
b.r = a
assert c.s.w.v.t.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: A = None
        self.q: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: D = None
        self.z: C = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
j = C("j")
e = D("e")
n = A("n")
f = C("f")
h = D("h")
d = D("d")
a = C("a")
b = D("b")

c.w = j
c.s = n
c.q = n
g.t = j
g.z = j
g.r = d
j.v = g
j.q = g
j.o = a
j.r = a
e.r = j
n.w = a
n.s = c
n.q = c
f.v = g
f.q = g
f.o = a
f.r = a
h.r = f
d.r = j
a.v = g
a.q = g
a.o = f
a.r = j
b.r = a
assert c.s.w.v.t.q.z.txt == "j"