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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.v: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.v: C = None
        self.txt = txt

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

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