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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.v: H = None
        self.p: A = None
        self.q: H = None
        self.y: B = None
        self.t: D = None
        self.s: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: D = None
        self.w: F = None
        self.t: F = None
        self.txt = txt

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

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

j.r = e
j.t = d
j.w = n
e.z = h
b.s = h
b.y = h
b.r = e
b.u = d
h.x = d
h.t = j
n.u = k
n.v = i
n.q = i
n.p = j
n.y = e
n.t = h
n.s = h
d.t = h
c.p = b
c.y = h
c.w = d
c.t = d
k.w = c
i.w = c
assert k.w.y.t.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: F = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.v: H = None
        self.p: A = None
        self.q: H = None
        self.y: B = None
        self.t: D = None
        self.s: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: D = None
        self.w: F = None
        self.t: F = None
        self.txt = txt

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

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

j.r = e
j.t = d
j.w = n
e.z = h
b.s = h
b.y = h
b.r = e
b.u = d
h.x = d
h.t = j
n.u = k
n.v = i
n.q = i
n.p = j
n.y = e
n.t = h
n.s = h
d.t = h
c.p = b
c.y = h
c.w = d
c.t = d
k.w = c
i.w = c
assert k.w.y.t.w.v.txt == "i"