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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: E = None
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: D = None
        self.r: F = None
        self.p: C = None
        self.x: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: E = None
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: D = None
        self.r: F = None
        self.p: C = None
        self.x: C = None
        self.txt = txt

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

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

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