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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: C = None
        self.q: D = None
        self.o: A = None
        self.p: F = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: C = None
        self.q: D = None
        self.o: A = None
        self.p: F = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.v: D = None
        self.txt = txt

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

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

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