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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: E = None
        self.x: D = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: A = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: G = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: C = None
        self.z: D = None
        self.q: G = None
        self.t: D = None
        self.txt = txt

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

n.y = a
n.r = c
n.t = k
e.r = k
e.u = m
e.x = a
e.t = a
c.z = k
c.u = k
c.w = n
a.x = b
m.r = e
m.s = e
m.x = d
k.p = d
d.q = b
d.w = c
b.o = m
b.r = c
b.z = a
b.t = a
b.q = d
assert d.w.w.t.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: C = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: E = None
        self.x: D = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: A = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: G = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: C = None
        self.z: D = None
        self.q: G = None
        self.t: D = None
        self.txt = txt

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

n.y = a
n.r = c
n.t = k
e.r = k
e.u = m
e.x = a
e.t = a
c.z = k
c.u = k
c.w = n
a.x = b
m.r = e
m.s = e
m.x = d
k.p = d
d.q = b
d.w = c
b.o = m
b.r = c
b.z = a
b.t = a
b.q = d
assert d.w.w.t.p.w.txt == "c"