class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: G = None
        self.w: F = None
        self.t: D = None
        self.r: H = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.x: H = None
        self.z: E = None
        self.q: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: D = None
        self.txt = txt

d = A("d")
g = B("g")
m = C("m")
n = D("n")
f = E("f")
i = F("i")
b = G("b")
c = H("c")

d.p = f
d.z = b
d.w = i
d.t = n
d.y = n
d.r = c
g.o = c
m.r = n
n.o = b
n.q = i
n.w = c
f.z = c
i.w = g
b.y = c
b.x = c
b.z = f
b.q = i
c.w = d
c.y = n
assert f.z.y.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: G = None
        self.w: F = None
        self.t: D = None
        self.r: H = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.x: H = None
        self.z: E = None
        self.q: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: D = None
        self.txt = txt

d = A("d")
g = B("g")
m = C("m")
n = D("n")
f = E("f")
i = F("i")
b = G("b")
c = H("c")

d.p = f
d.z = b
d.w = i
d.t = n
d.y = n
d.r = c
g.o = c
m.r = n
n.o = b
n.q = i
n.w = c
f.z = c
i.w = g
b.y = c
b.x = c
b.z = f
b.q = i
c.w = d
c.y = n
assert f.z.y.w.w.r.txt == "c"