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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

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