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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.q: A = None
        self.x: A = None
        self.z: C = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
k = C("k")
g = D("g")
j = E("j")
n = C("n")

a.y = n
a.u = d
a.v = d
d.t = g
d.o = j
d.q = a
d.x = a
d.z = k
k.y = g
k.o = j
k.p = n
g.w = d
g.x = n
j.o = g
j.x = g
j.z = n
n.y = g
n.o = j
n.p = k
assert j.z.y.x.y.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: B = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.q: A = None
        self.x: A = None
        self.z: C = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
k = C("k")
g = D("g")
j = E("j")
n = C("n")

a.y = n
a.u = d
a.v = d
d.t = g
d.o = j
d.q = a
d.x = a
d.z = k
k.y = g
k.o = j
k.p = n
g.w = d
g.x = n
j.o = g
j.x = g
j.z = n
n.y = g
n.o = j
n.p = k
assert j.z.y.x.y.w.z.txt == "k"