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

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

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

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

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

f.q = a
f.o = a
f.s = a
f.z = e
h.r = a
h.t = f
k.z = h
k.w = e
a.q = e
a.z = e
e.z = i
e.w = k
n.r = a
n.t = f
i.r = a
i.t = f
assert a.q.z.r.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: C = None
        self.o: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

f.q = a
f.o = a
f.s = a
f.z = e
h.r = a
h.t = f
k.z = h
k.w = e
a.q = e
a.z = e
e.z = i
e.w = k
n.r = a
n.t = f
i.r = a
i.t = f
assert a.q.z.r.q.w.txt == "k"