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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.v: E = None
        self.x: B = None
        self.txt = txt

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

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

h.t = j
h.y = a
h.o = a
l.v = d
l.x = j
j.t = a
j.u = h
a.o = l
a.s = l
a.x = l
a.v = d
d.w = h
d.z = j
assert h.y.v.z.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: D = None
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.v: E = None
        self.x: B = None
        self.txt = txt

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

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

h.t = j
h.y = a
h.o = a
l.v = d
l.x = j
j.t = a
j.u = h
a.o = l
a.s = l
a.x = l
a.v = d
d.w = h
d.z = j
assert h.y.v.z.t.v.txt == "d"