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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.o: A = None
        self.u: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: F = None
        self.s: F = None
        self.o: A = None
        self.q: D = None
        self.v: A = None
        self.txt = txt

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

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

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

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

b.q = g
c.v = k
c.u = k
c.o = b
n.z = k
n.w = k
n.s = k
n.o = b
n.v = b
n.q = j
i.p = c
i.w = b
i.o = b
i.q = b
i.r = g
g.w = k
g.q = n
k.x = g
j.p = c
j.w = b
j.o = b
j.q = b
j.r = g
assert n.q.q.q.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.o: A = None
        self.u: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: F = None
        self.s: F = None
        self.o: A = None
        self.q: D = None
        self.v: A = None
        self.txt = txt

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

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

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

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

b.q = g
c.v = k
c.u = k
c.o = b
n.z = k
n.w = k
n.s = k
n.o = b
n.v = b
n.q = j
i.p = c
i.w = b
i.o = b
i.q = b
i.r = g
g.w = k
g.q = n
k.x = g
j.p = c
j.w = b
j.o = b
j.q = b
j.r = g
assert n.q.q.q.w.x.txt == "g"