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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: G = None
        self.p: A = None
        self.z: A = None
        self.y: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.v: E = None
        self.r: B = None
        self.o: A = None
        self.q: F = None
        self.txt = txt

m = A("m")
j = B("j")
i = C("i")
a = D("a")
l = E("l")
h = F("h")
c = G("c")
n = C("n")

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: G = None
        self.p: A = None
        self.z: A = None
        self.y: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.v: E = None
        self.r: B = None
        self.o: A = None
        self.q: F = None
        self.txt = txt

m = A("m")
j = B("j")
i = C("i")
a = D("a")
l = E("l")
h = F("h")
c = G("c")
n = C("n")

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