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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: C = None
        self.v: E = None
        self.y: C = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

h.w = k
h.q = f
h.v = f
h.t = f
h.o = c
c.o = f
c.t = f
c.y = f
c.v = k
c.x = k
f.t = b
b.y = h
b.z = h
b.w = f
b.u = k
k.w = c
k.u = c
assert h.v.t.z.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: C = None
        self.v: C = None
        self.t: C = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: C = None
        self.v: E = None
        self.y: C = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

h.w = k
h.q = f
h.v = f
h.t = f
h.o = c
c.o = f
c.t = f
c.y = f
c.v = k
c.x = k
f.t = b
b.y = h
b.z = h
b.w = f
b.u = k
k.w = c
k.u = c
assert h.v.t.z.v.t.txt == "b"