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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: C = None
        self.q: E = None
        self.v: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: H = None
        self.z: D = None
        self.u: B = None
        self.x: A = None
        self.r: H = None
        self.txt = txt

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

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

i = A("i")
m = B("m")
h = C("h")
d = D("d")
b = E("b")
a = F("a")
f = G("f")
e = H("e")
c = D("c")

i.p = m
i.y = h
m.t = a
h.w = a
d.x = a
d.v = a
d.t = h
d.q = b
b.q = h
b.u = a
b.w = a
b.z = i
a.y = e
a.r = e
a.z = d
a.u = m
a.x = i
f.r = m
e.v = h
e.w = h
e.t = h
c.x = a
c.v = a
c.t = h
c.q = b
assert h.w.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: C = None
        self.q: E = None
        self.v: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: H = None
        self.z: D = None
        self.u: B = None
        self.x: A = None
        self.r: H = None
        self.txt = txt

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

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

i = A("i")
m = B("m")
h = C("h")
d = D("d")
b = E("b")
a = F("a")
f = G("f")
e = H("e")
c = D("c")

i.p = m
i.y = h
m.t = a
h.w = a
d.x = a
d.v = a
d.t = h
d.q = b
b.q = h
b.u = a
b.w = a
b.z = i
a.y = e
a.r = e
a.z = d
a.u = m
a.x = i
f.r = m
e.v = h
e.w = h
e.t = h
c.x = a
c.v = a
c.t = h
c.q = b
assert h.w.z.t.txt == "h"