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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: C = None
        self.u: B = None
        self.q: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: C = None
        self.u: B = None
        self.q: C = None
        self.txt = txt

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

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

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