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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: E = None
        self.z: E = None
        self.txt = txt

b = A("b")
g = B("g")
m = C("m")
d = D("d")
k = E("k")
e = A("e")
j = E("j")

b.u = m
b.v = d
b.s = k
b.z = e
g.p = j
g.t = b
g.z = d
m.x = d
m.v = b
d.q = k
d.v = m
k.s = j
k.v = j
k.z = j
e.u = m
e.v = d
e.s = k
e.z = b
j.s = k
j.v = k
j.z = k
assert k.s.s.v.v.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: D = None
        self.s: E = None
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: E = None
        self.z: E = None
        self.txt = txt

b = A("b")
g = B("g")
m = C("m")
d = D("d")
k = E("k")
e = A("e")
j = E("j")

b.u = m
b.v = d
b.s = k
b.z = e
g.p = j
g.t = b
g.z = d
m.x = d
m.v = b
d.q = k
d.v = m
k.s = j
k.v = j
k.z = j
e.u = m
e.v = d
e.s = k
e.z = b
j.s = k
j.v = k
j.z = k
assert k.s.s.v.v.s.v.s.txt == "j"