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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = None
        self.s: B = None
        self.v: H = None
        self.p: G = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.t: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: B = None
        self.txt = txt

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

n.u = k
n.p = f
i.q = h
i.y = n
b.x = m
b.u = i
m.s = b
m.y = i
k.q = h
k.s = h
k.p = n
j.q = k
j.w = k
j.s = i
j.v = f
j.p = e
j.u = e
e.w = m
e.x = n
e.t = n
f.q = m
f.s = i
h.x = m
h.u = i
assert j.s.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: H = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = None
        self.s: B = None
        self.v: H = None
        self.p: G = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.t: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: B = None
        self.txt = txt

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

n.u = k
n.p = f
i.q = h
i.y = n
b.x = m
b.u = i
m.s = b
m.y = i
k.q = h
k.s = h
k.p = n
j.q = k
j.w = k
j.s = i
j.v = f
j.p = e
j.u = e
e.w = m
e.x = n
e.t = n
f.q = m
f.s = i
h.x = m
h.u = i
assert j.s.y.p.txt == "f"