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

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

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

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

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

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

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

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

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

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

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

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

e.q = l
e.v = k
e.p = f
e.w = f
e.z = h
b.s = l
b.v = l
b.u = e
b.q = h
k.v = f
k.r = b
f.r = l
h.u = f
h.o = b
l.q = e
l.v = k
l.p = f
l.w = f
l.z = h
assert l.w.r.v.r.txt == "b"