class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: G = None
        self.u: F = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: D = None
        self.u: G = None
        self.q: E = None
        self.t: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: G = None
        self.t: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

e = A("e")
i = B("i")
c = C("c")
a = D("a")
m = E("m")
g = F("g")
n = G("n")

e.p = a
e.t = c
i.r = a
i.v = n
i.u = g
i.p = c
c.y = i
c.v = a
c.u = n
c.t = n
c.q = m
a.y = c
a.x = g
a.z = m
m.z = g
m.x = n
m.t = i
g.y = i
g.z = i
g.u = m
g.q = a
g.s = a
g.v = e
g.w = c
n.u = c
assert a.z.t.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: G = None
        self.u: F = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: D = None
        self.u: G = None
        self.q: E = None
        self.t: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: G = None
        self.t: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

e = A("e")
i = B("i")
c = C("c")
a = D("a")
m = E("m")
g = F("g")
n = G("n")

e.p = a
e.t = c
i.r = a
i.v = n
i.u = g
i.p = c
c.y = i
c.v = a
c.u = n
c.t = n
c.q = m
a.y = c
a.x = g
a.z = m
m.z = g
m.x = n
m.t = i
g.y = i
g.z = i
g.u = m
g.q = a
g.s = a
g.v = e
g.w = c
n.u = c
assert a.z.t.u.v.txt == "e"