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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: D = None
        self.y: G = None
        self.p: G = None
        self.x: E = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: D = None
        self.txt = txt

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

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

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

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

g = A("g")
b = B("b")
m = C("m")
a = D("a")
d = E("d")
e = F("e")
c = G("c")
h = E("h")
l = G("l")
f = A("f")

g.v = a
g.y = b
g.r = b
b.q = a
b.u = a
b.y = l
b.p = c
b.x = d
b.r = d
m.y = e
m.v = a
a.q = c
a.o = h
a.w = l
a.r = f
d.q = m
d.z = b
e.r = c
e.u = f
e.o = l
e.q = b
c.v = f
h.q = m
h.z = b
l.v = f
f.v = a
f.y = b
f.r = b
assert b.q.q.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: B = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: D = None
        self.y: G = None
        self.p: G = None
        self.x: E = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: D = None
        self.txt = txt

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

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

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

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

g = A("g")
b = B("b")
m = C("m")
a = D("a")
d = E("d")
e = F("e")
c = G("c")
h = E("h")
l = G("l")
f = A("f")

g.v = a
g.y = b
g.r = b
b.q = a
b.u = a
b.y = l
b.p = c
b.x = d
b.r = d
m.y = e
m.v = a
a.q = c
a.o = h
a.w = l
a.r = f
d.q = m
d.z = b
e.r = c
e.u = f
e.o = l
e.q = b
c.v = f
h.q = m
h.z = b
l.v = f
f.v = a
f.y = b
f.r = b
assert b.q.q.v.v.txt == "a"