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

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

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

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

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

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

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

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

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

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

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

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

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

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

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