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

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

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

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

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

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

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

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

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

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

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

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

h.t = b
h.v = b
h.z = f
f.u = g
f.t = g
f.o = g
f.q = d
d.w = f
d.x = g
b.v = d
b.x = h
g.u = b
g.x = d
g.t = d
g.p = h
g.q = h
assert d.w.q.x.u.txt == "b"