class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.w: B = None
        self.x: B = None
        self.r: C = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: A = None
        self.x: B = None
        self.q: A = None
        self.y: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.w: B = None
        self.x: B = None
        self.r: C = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: A = None
        self.x: B = None
        self.q: A = None
        self.y: C = None
        self.txt = txt

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

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