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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.w: E = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.v: B = None
        self.p: G = None
        self.q: F = None
        self.u: F = None
        self.y: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: C = None
        self.q: A = None
        self.r: A = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.r: B = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
l = C("l")
c = D("c")
b = E("b")
e = F("e")
k = G("k")

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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.w: E = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.v: B = None
        self.p: G = None
        self.q: F = None
        self.u: F = None
        self.y: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: C = None
        self.q: A = None
        self.r: A = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.r: B = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
l = C("l")
c = D("c")
b = E("b")
e = F("e")
k = G("k")

g.q = b
g.z = l
n.v = k
n.z = k
n.w = b
l.o = e
l.x = e
l.q = e
l.u = e
l.v = n
l.p = k
l.y = k
c.o = k
c.v = l
c.q = g
c.r = g
c.t = n
b.p = e
b.r = n
e.o = g
e.p = g
k.v = n
assert g.z.p.v.w.p.txt == "e"