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

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

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

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

e = A("e")
h = B("h")
i = C("i")
j = D("j")
n = D("n")
d = A("d")

e.t = n
e.z = d
h.o = i
h.w = i
h.q = i
h.z = j
i.o = h
j.q = i
j.y = n
n.q = i
n.y = j
d.t = j
d.z = e
assert h.z.y.q.o.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: A = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
i = C("i")
j = D("j")
n = D("n")
d = A("d")

e.t = n
e.z = d
h.o = i
h.w = i
h.q = i
h.z = j
i.o = h
j.q = i
j.y = n
n.q = i
n.y = j
d.t = j
d.z = e
assert h.z.y.q.o.z.q.txt == "i"