class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.v: D = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: D = None
        self.o: D = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: D = None
        self.x: D = None
        self.s: B = None
        self.q: D = None
        self.txt = txt

a = A("a")
g = B("g")
i = C("i")
b = D("b")
h = E("h")
d = A("d")

a.z = d
a.q = h
a.v = b
a.r = g
g.r = h
g.y = d
i.r = h
i.w = h
i.x = b
i.o = b
b.w = d
b.v = d
b.x = h
b.s = i
b.p = g
h.t = d
h.u = b
h.x = b
h.q = b
h.s = g
d.z = a
d.q = h
d.v = b
d.r = g
assert d.q.q.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.v: D = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: D = None
        self.o: D = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: D = None
        self.x: D = None
        self.s: B = None
        self.q: D = None
        self.txt = txt

a = A("a")
g = B("g")
i = C("i")
b = D("b")
h = E("h")
d = A("d")

a.z = d
a.q = h
a.v = b
a.r = g
g.r = h
g.y = d
i.r = h
i.w = h
i.x = b
i.o = b
b.w = d
b.v = d
b.x = h
b.s = i
b.p = g
h.t = d
h.u = b
h.x = b
h.q = b
h.s = g
d.z = a
d.q = h
d.v = b
d.r = g
assert d.q.q.v.r.txt == "g"