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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: H = None
        self.y: G = None
        self.s: F = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.z: C = None
        self.t: C = None
        self.w: A = None
        self.r: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: H = None
        self.y: G = None
        self.s: F = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.z: C = None
        self.t: C = None
        self.w: A = None
        self.r: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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