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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: C = None
        self.s: F = None
        self.o: C = None
        self.x: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.v: D = None
        self.u: A = None
        self.t: G = None
        self.txt = txt

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

i.p = c
i.r = e
i.q = e
i.u = e
d.v = f
d.s = f
d.t = e
d.o = e
d.x = h
e.t = h
e.o = b
c.u = j
c.q = i
j.v = d
f.t = d
b.t = c
b.v = c
b.u = d
b.r = f
b.x = e
h.p = b
h.t = b
h.v = c
h.u = i
assert b.r.t.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: C = None
        self.q: C = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: C = None
        self.s: F = None
        self.o: C = None
        self.x: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.v: D = None
        self.u: A = None
        self.t: G = None
        self.txt = txt

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

i.p = c
i.r = e
i.q = e
i.u = e
d.v = f
d.s = f
d.t = e
d.o = e
d.x = h
e.t = h
e.o = b
c.u = j
c.q = i
j.v = d
f.t = d
b.t = c
b.v = c
b.u = d
b.r = f
b.x = e
h.p = b
h.t = b
h.v = c
h.u = i
assert b.r.t.o.t.txt == "h"