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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: F = None
        self.p: F = None
        self.v: D = None
        self.u: F = None
        self.txt = txt

a = A("a")
n = B("n")
g = C("g")
m = D("m")
e = E("e")
h = F("h")
k = F("k")
b = A("b")
c = D("c")

a.v = g
a.u = b
a.q = k
n.s = h
n.x = m
g.q = e
m.x = h
m.y = n
e.v = b
h.s = m
h.v = m
h.z = k
h.p = k
h.u = k
k.s = c
k.z = h
k.p = h
k.u = h
k.v = m
b.v = g
b.u = a
b.q = h
c.x = h
c.y = n
assert g.q.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: A = None
        self.q: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: F = None
        self.p: F = None
        self.v: D = None
        self.u: F = None
        self.txt = txt

a = A("a")
n = B("n")
g = C("g")
m = D("m")
e = E("e")
h = F("h")
k = F("k")
b = A("b")
c = D("c")

a.v = g
a.u = b
a.q = k
n.s = h
n.x = m
g.q = e
m.x = h
m.y = n
e.v = b
h.s = m
h.v = m
h.z = k
h.p = k
h.u = k
k.s = c
k.z = h
k.p = h
k.u = h
k.v = m
b.v = g
b.u = a
b.q = h
c.x = h
c.y = n
assert g.q.v.q.v.txt == "m"