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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: D = None
        self.t: D = None
        self.s: D = None
        self.r: D = None
        self.txt = txt

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

h.y = l
l.q = h
l.s = h
l.w = b
l.t = b
b.v = h
f.z = h
f.y = j
f.w = d
f.s = b
j.y = h
j.o = d
j.t = d
j.s = d
j.r = d
d.z = h
d.y = j
d.w = f
d.s = b
assert h.y.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: D = None
        self.t: D = None
        self.s: D = None
        self.r: D = None
        self.txt = txt

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

h.y = l
l.q = h
l.s = h
l.w = b
l.t = b
b.v = h
f.z = h
f.y = j
f.w = d
f.s = b
j.y = h
j.o = d
j.t = d
j.s = d
j.r = d
d.z = h
d.y = j
d.w = f
d.s = b
assert h.y.t.v.txt == "h"