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

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

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

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

e = A("e")
d = B("d")
b = C("b")
m = D("m")
c = D("c")
i = B("i")
k = D("k")
h = D("h")
a = C("a")
g = A("g")

e.q = a
e.s = g
e.x = i
d.x = i
d.v = i
d.w = b
d.t = g
b.p = a
b.v = m
b.w = e
b.z = d
m.t = e
c.t = e
i.x = d
i.v = d
i.w = a
i.t = e
k.t = e
h.t = g
a.p = b
a.v = c
a.w = g
a.z = d
g.q = a
g.s = e
g.x = d
assert m.t.x.x.w.p.p.p.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: A = None
        self.x: B = None
        self.txt = txt

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

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

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

e = A("e")
d = B("d")
b = C("b")
m = D("m")
c = D("c")
i = B("i")
k = D("k")
h = D("h")
a = C("a")
g = A("g")

e.q = a
e.s = g
e.x = i
d.x = i
d.v = i
d.w = b
d.t = g
b.p = a
b.v = m
b.w = e
b.z = d
m.t = e
c.t = e
i.x = d
i.v = d
i.w = a
i.t = e
k.t = e
h.t = g
a.p = b
a.v = c
a.w = g
a.z = d
g.q = a
g.s = e
g.x = d
assert m.t.x.x.w.p.p.p.z.t.txt == "g"