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

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: E = None
        self.o: B = None
        self.z: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: F = None
        self.t: C = None
        self.x: C = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.p: D = None
        self.txt = txt

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

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

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

a.t = i
e.t = g
m.x = n
m.w = c
m.z = c
m.o = e
n.u = m
c.v = n
c.r = n
c.z = i
c.t = m
c.x = m
i.q = b
i.p = n
b.w = g
b.u = e
g.v = e
g.o = e
g.y = a
g.t = a
g.q = i
assert e.t.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: E = None
        self.o: B = None
        self.z: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: F = None
        self.t: C = None
        self.x: C = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.p: D = None
        self.txt = txt

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

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

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

a.t = i
e.t = g
m.x = n
m.w = c
m.z = c
m.o = e
n.u = m
c.v = n
c.r = n
c.z = i
c.t = m
c.x = m
i.q = b
i.p = n
b.w = g
b.u = e
g.v = e
g.o = e
g.y = a
g.t = a
g.q = i
assert e.t.q.p.txt == "n"