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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: E = None
        self.o: F = None
        self.y: F = None
        self.q: A = None
        self.x: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
c = C("c")
k = D("k")
g = E("g")
h = F("h")
l = F("l")
m = B("m")

a.v = c
a.w = c
a.p = c
a.y = m
f.v = l
f.y = l
f.z = g
f.x = g
f.o = h
f.q = a
c.o = l
c.x = k
c.t = m
c.s = m
k.v = g
k.r = g
g.z = a
g.r = a
g.w = h
g.s = h
g.q = c
h.q = m
l.q = f
m.v = l
m.o = l
m.y = l
m.z = g
m.x = g
m.q = a
assert m.q.y.x.z.p.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.p: C = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: E = None
        self.o: F = None
        self.y: F = None
        self.q: A = None
        self.x: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
c = C("c")
k = D("k")
g = E("g")
h = F("h")
l = F("l")
m = B("m")

a.v = c
a.w = c
a.p = c
a.y = m
f.v = l
f.y = l
f.z = g
f.x = g
f.o = h
f.q = a
c.o = l
c.x = k
c.t = m
c.s = m
k.v = g
k.r = g
g.z = a
g.r = a
g.w = h
g.s = h
g.q = c
h.q = m
l.q = f
m.v = l
m.o = l
m.y = l
m.z = g
m.x = g
m.q = a
assert m.q.y.x.z.p.x.v.txt == "g"