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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

f.t = d
f.q = b
f.u = b
f.s = c
f.v = c
b.y = d
h.y = b
h.w = f
d.s = b
d.u = b
d.w = h
d.x = f
d.p = m
m.q = b
c.q = b
assert c.q.y.w.txt == "h"