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

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

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

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

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

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

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

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

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

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

f.w = a
f.t = j
j.z = e
e.q = i
e.w = j
e.x = f
i.s = a
i.o = n
i.z = n
n.z = e
a.s = i
a.o = j
a.z = n
assert e.x.t.z.w.z.q.txt == "i"