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

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

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

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

m = A("m")
e = B("e")
h = C("h")
n = D("n")
g = C("g")
d = B("d")

m.t = n
e.w = d
e.u = d
e.t = n
h.s = n
h.v = g
h.z = g
h.w = m
n.u = g
n.q = e
g.s = n
g.v = h
g.z = h
g.w = m
d.w = e
d.u = e
d.t = n
assert d.u.t.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

m = A("m")
e = B("e")
h = C("h")
n = D("n")
g = C("g")
d = B("d")

m.t = n
e.w = d
e.u = d
e.t = n
h.s = n
h.v = g
h.z = g
h.w = m
n.u = g
n.q = e
g.s = n
g.v = h
g.z = h
g.w = m
d.w = e
d.u = e
d.t = n
assert d.u.t.q.t.txt == "n"