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

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

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

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

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

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

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

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

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

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

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