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

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

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

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

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

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

d = A("d")
f = B("f")
k = C("k")
n = D("n")
a = E("a")
g = F("g")
c = C("c")
b = D("b")

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

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

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

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

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

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

d = A("d")
f = B("f")
k = C("k")
n = D("n")
a = E("a")
g = F("g")
c = C("c")
b = D("b")

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