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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: B = None
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

f.q = g
l.p = a
l.s = j
l.t = f
l.o = n
k.v = f
k.w = l
k.p = j
k.u = n
g.t = l
g.y = f
g.x = a
g.q = n
a.x = n
a.w = n
a.v = g
a.p = l
j.p = a
j.s = l
j.t = f
j.o = k
n.v = f
n.w = j
n.p = l
n.u = k
assert j.p.p.s.s.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: B = None
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

f.q = g
l.p = a
l.s = j
l.t = f
l.o = n
k.v = f
k.w = l
k.p = j
k.u = n
g.t = l
g.y = f
g.x = a
g.q = n
a.x = n
a.w = n
a.v = g
a.p = l
j.p = a
j.s = l
j.t = f
j.o = k
n.v = f
n.w = j
n.p = l
n.u = k
assert j.p.p.s.s.t.q.txt == "g"