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

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

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

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

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

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

m = A("m")
h = B("h")
c = C("c")
a = D("a")
k = E("k")
n = F("n")

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

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

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

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

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

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

m = A("m")
h = B("h")
c = C("c")
a = D("a")
k = E("k")
n = F("n")

m.r = n
m.z = n
h.v = m
h.w = m
h.t = k
h.r = a
h.o = c
c.q = n
c.z = h
c.w = a
a.p = m
a.y = k
a.r = c
a.v = c
a.x = h
a.o = h
k.u = m
k.x = m
n.o = m
n.r = a
assert m.r.r.y.u.z.txt == "n"