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

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

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

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

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

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

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

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

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

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

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

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

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

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

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