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

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

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

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

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

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

h.v = k
h.q = k
h.r = b
h.o = a
h.s = f
k.s = d
k.p = f
b.u = h
b.y = h
a.y = b
a.r = d
f.z = b
f.y = a
f.o = h
d.v = k
d.q = k
d.r = b
d.o = a
d.s = f
assert d.o.y.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.o: D = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

h.v = k
h.q = k
h.r = b
h.o = a
h.s = f
k.s = d
k.p = f
b.u = h
b.y = h
a.y = b
a.r = d
f.z = b
f.y = a
f.o = h
d.v = k
d.q = k
d.r = b
d.o = a
d.s = f
assert d.o.y.y.s.y.txt == "a"