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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: B = None
        self.t: B = None
        self.o: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: B = None
        self.t: B = None
        self.o: D = None
        self.txt = txt

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

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

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

n.w = a
n.x = h
n.z = c
c.s = d
c.q = h
c.t = h
c.o = b
a.s = h
a.o = c
a.z = c
a.u = b
d.v = a
d.o = a
f.w = a
f.x = h
f.z = h
h.s = b
h.o = b
h.q = c
h.t = c
b.v = a
b.o = a
assert n.z.q.q.o.txt == "b"