class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: C = None
        self.u: C = None
        self.p: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: D = None
        self.p: E = None
        self.y: A = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: F = None
        self.p: F = None
        self.w: D = None
        self.x: D = None
        self.t: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: D = None
        self.p: E = None
        self.y: A = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: F = None
        self.p: F = None
        self.w: D = None
        self.x: D = None
        self.t: D = None
        self.txt = txt

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

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