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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: E = None
        self.u: D = None
        self.z: C = None
        self.p: C = None
        self.w: G = None
        self.s: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: G = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: E = None
        self.u: D = None
        self.z: C = None
        self.p: C = None
        self.w: G = None
        self.s: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: G = None
        self.txt = txt

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

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

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