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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

g.p = n
n.w = e
n.v = g
n.y = b
n.t = b
n.r = b
f.v = n
e.u = n
e.s = g
m.v = n
m.x = a
m.p = g
b.s = g
b.u = g
b.p = m
b.z = e
b.o = e
b.v = a
b.r = f
a.y = g
assert e.s.p.w.s.p.y.o.txt == "e"