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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: G = None
        self.s: F = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: G = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.u: B = None
        self.r: D = None
        self.x: D = None
        self.v: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: C = None
        self.q: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: G = None
        self.s: F = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: G = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.u: B = None
        self.r: D = None
        self.x: D = None
        self.v: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: C = None
        self.q: G = None
        self.txt = txt

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

b.q = a
c.w = k
c.z = k
c.s = f
c.x = n
n.x = g
n.o = k
n.u = e
g.z = e
e.w = m
e.u = c
e.r = g
e.x = g
e.v = k
f.s = g
f.w = c
k.r = a
m.s = k
m.q = k
m.u = n
a.x = g
a.o = k
a.u = e
assert g.z.r.z.txt == "e"