class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.v: F = None
        self.w: E = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

i = A("i")
d = B("d")
a = C("a")
l = D("l")
h = E("h")
m = F("m")

i.p = l
i.z = l
i.q = d
i.r = d
i.v = m
i.w = h
d.u = i
a.s = h
a.r = d
a.y = l
l.q = i
l.t = h
l.w = m
h.o = a
h.r = m
h.t = d
m.u = d
m.z = i
m.v = h
assert m.z.v.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.v: F = None
        self.w: E = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

i = A("i")
d = B("d")
a = C("a")
l = D("l")
h = E("h")
m = F("m")

i.p = l
i.z = l
i.q = d
i.r = d
i.v = m
i.w = h
d.u = i
a.s = h
a.r = d
a.y = l
l.q = i
l.t = h
l.w = m
h.o = a
h.r = m
h.t = d
m.u = d
m.z = i
m.v = h
assert m.z.v.u.u.r.txt == "d"