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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: G = None
        self.p: C = None
        self.q: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: H = None
        self.t: H = None
        self.txt = txt

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

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

c.t = j
c.w = g
c.y = m
c.q = b
j.o = g
i.y = c
h.o = g
h.w = c
h.x = e
h.s = e
h.p = e
g.o = e
g.y = e
g.p = i
g.q = j
b.w = e
b.s = c
b.t = g
e.r = g
e.y = m
e.t = m
m.w = i
m.y = i
n.o = g
assert g.q.o.q.o.o.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: E = None
        self.y: H = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: G = None
        self.p: C = None
        self.q: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: H = None
        self.t: H = None
        self.txt = txt

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

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

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