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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: A = None
        self.y: E = None
        self.o: A = None
        self.p: B = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
f = C("f")
k = D("k")
e = E("e")
m = D("m")

j.q = e
j.u = f
j.p = f
j.v = k
a.y = k
f.x = j
f.u = j
f.o = j
f.y = e
f.p = a
k.w = a
k.y = f
k.s = f
e.r = m
e.p = j
e.y = j
m.w = a
m.y = f
m.s = f
assert e.p.v.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: C = None
        self.v: D = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: A = None
        self.y: E = None
        self.o: A = None
        self.p: B = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
f = C("f")
k = D("k")
e = E("e")
m = D("m")

j.q = e
j.u = f
j.p = f
j.v = k
a.y = k
f.x = j
f.u = j
f.o = j
f.y = e
f.p = a
k.w = a
k.y = f
k.s = f
e.r = m
e.p = j
e.y = j
m.w = a
m.y = f
m.s = f
assert e.p.v.w.y.txt == "k"