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

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

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

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

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

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

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

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

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

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

f.w = i
f.o = i
f.x = e
f.z = n
m.q = e
m.x = i
i.w = e
i.u = e
e.q = h
e.t = i
e.y = a
a.w = i
a.o = i
a.x = h
a.z = f
c.w = i
c.o = i
c.x = e
c.z = a
n.w = i
n.o = i
n.x = h
n.z = c
h.q = e
h.t = i
h.y = f
assert m.q.y.z.txt == "f"