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

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

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

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

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

b = A("b")
h = B("h")
f = C("f")
a = D("a")
m = E("m")
c = A("c")
g = A("g")

b.t = a
b.x = h
b.s = h
b.z = c
b.p = f
h.u = m
h.z = m
h.w = a
f.s = m
f.y = h
f.t = a
f.x = c
a.u = h
a.q = f
m.w = f
m.s = h
c.t = a
c.x = h
c.s = h
c.z = b
c.p = f
g.t = a
g.x = h
g.s = h
g.z = b
g.p = f
assert a.u.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: B = None
        self.z: A = None
        self.s: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

b = A("b")
h = B("h")
f = C("f")
a = D("a")
m = E("m")
c = A("c")
g = A("g")

b.t = a
b.x = h
b.s = h
b.z = c
b.p = f
h.u = m
h.z = m
h.w = a
f.s = m
f.y = h
f.t = a
f.x = c
a.u = h
a.q = f
m.w = f
m.s = h
c.t = a
c.x = h
c.s = h
c.z = b
c.p = f
g.t = a
g.x = h
g.s = h
g.z = b
g.p = f
assert a.u.w.q.txt == "f"