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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: B = None
        self.q: A = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
k = C("k")
f = D("f")
i = E("i")
c = A("c")
d = B("d")
a = D("a")

g.s = c
j.w = i
j.z = d
j.q = g
k.z = i
f.o = g
f.u = a
f.w = j
f.z = k
f.t = k
i.v = f
c.s = g
d.w = i
d.z = j
d.q = g
a.o = c
a.u = f
a.w = j
a.z = k
a.t = k
assert j.q.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: B = None
        self.q: A = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
k = C("k")
f = D("f")
i = E("i")
c = A("c")
d = B("d")
a = D("a")

g.s = c
j.w = i
j.z = d
j.q = g
k.z = i
f.o = g
f.u = a
f.w = j
f.z = k
f.t = k
i.v = f
c.s = g
d.w = i
d.z = j
d.q = g
a.o = c
a.u = f
a.w = j
a.z = k
a.t = k
assert j.q.s.s.s.s.txt == "g"