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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

n = A("n")
b = B("b")
f = C("f")
h = D("h")
i = E("i")
k = D("k")

n.w = f
b.s = i
b.w = n
f.y = i
h.q = f
h.u = b
h.x = b
h.w = k
i.y = f
k.q = f
k.u = b
k.x = b
k.w = h
assert h.w.q.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

n = A("n")
b = B("b")
f = C("f")
h = D("h")
i = E("i")
k = D("k")

n.w = f
b.s = i
b.w = n
f.y = i
h.q = f
h.u = b
h.x = b
h.w = k
i.y = f
k.q = f
k.u = b
k.x = b
k.w = h
assert h.w.q.y.y.y.txt == "i"