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

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

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

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

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

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

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

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

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

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

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

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

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