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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: G = None
        self.v: G = None
        self.t: F = None
        self.s: G = None
        self.r: E = None
        self.txt = txt

a = A("a")
d = B("d")
j = C("j")
i = D("i")
c = E("c")
b = F("b")
f = G("f")
m = A("m")
e = F("e")
n = G("n")

a.p = j
d.z = c
j.y = e
i.r = n
i.z = c
i.p = b
i.v = d
i.o = e
i.y = j
c.u = j
c.s = e
b.p = d
b.v = m
b.x = e
f.x = a
f.y = n
f.v = n
f.s = n
f.t = e
f.r = c
m.p = j
e.p = d
e.v = a
e.x = b
n.x = a
n.y = f
n.v = f
n.s = f
n.t = b
n.r = c
assert n.x.p.y.v.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: G = None
        self.v: G = None
        self.t: F = None
        self.s: G = None
        self.r: E = None
        self.txt = txt

a = A("a")
d = B("d")
j = C("j")
i = D("i")
c = E("c")
b = F("b")
f = G("f")
m = A("m")
e = F("e")
n = G("n")

a.p = j
d.z = c
j.y = e
i.r = n
i.z = c
i.p = b
i.v = d
i.o = e
i.y = j
c.u = j
c.s = e
b.p = d
b.v = m
b.x = e
f.x = a
f.y = n
f.v = n
f.s = n
f.t = e
f.r = c
m.p = j
e.p = d
e.v = a
e.x = b
n.x = a
n.y = f
n.v = f
n.s = f
n.t = b
n.r = c
assert n.x.p.y.v.p.y.txt == "e"