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

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: F = None
        self.txt = txt

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

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

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

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

e.p = h
e.o = b
a.v = e
a.q = h
a.x = h
m.s = e
m.p = h
n.o = f
n.w = f
h.q = f
h.w = f
h.u = f
f.r = m
f.p = m
f.v = h
b.v = e
b.x = f
b.q = a
b.p = h
b.y = h
b.w = m
assert a.x.q.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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