class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: D = None
        self.t: E = None
        self.r: H = None
        self.q: D = None
        self.v: D = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: F = None
        self.t: C = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: A = None
        self.o: B = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: D = None
        self.v: C = None
        self.y: G = None
        self.x: H = None
        self.r: F = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.u: C = None
        self.z: A = None
        self.w: G = None
        self.y: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: F = None
        self.t: C = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: A = None
        self.o: B = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: D = None
        self.v: C = None
        self.y: G = None
        self.x: H = None
        self.r: F = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.u: C = None
        self.z: A = None
        self.w: G = None
        self.y: C = None
        self.txt = txt

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

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