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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: B = None
        self.p: E = None
        self.r: D = None
        self.w: C = None
        self.q: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

d = A("d")
e = B("e")
b = C("b")
l = D("l")
n = E("n")
g = F("g")
a = B("a")
j = D("j")
k = E("k")

d.w = b
d.p = b
d.s = a
e.z = d
e.q = d
e.s = a
e.p = n
e.r = l
e.w = b
b.q = a
l.x = b
l.o = e
l.s = d
n.u = g
g.u = l
a.z = d
a.q = d
a.s = e
a.p = n
a.r = l
a.w = b
j.x = b
j.o = e
j.s = d
k.u = g
assert j.s.w.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: C = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: B = None
        self.p: E = None
        self.r: D = None
        self.w: C = None
        self.q: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

d = A("d")
e = B("e")
b = C("b")
l = D("l")
n = E("n")
g = F("g")
a = B("a")
j = D("j")
k = E("k")

d.w = b
d.p = b
d.s = a
e.z = d
e.q = d
e.s = a
e.p = n
e.r = l
e.w = b
b.q = a
l.x = b
l.o = e
l.s = d
n.u = g
g.u = l
a.z = d
a.q = d
a.s = e
a.p = n
a.r = l
a.w = b
j.x = b
j.o = e
j.s = d
k.u = g
assert j.s.w.q.w.q.txt == "a"