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

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

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

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

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

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

b = A("b")
e = B("e")
l = C("l")
h = D("h")
d = E("d")
a = F("a")
n = F("n")
i = E("i")

b.o = h
b.p = h
e.v = b
e.u = b
e.o = h
l.y = e
l.x = e
l.z = b
h.v = e
h.u = b
d.q = l
d.x = b
d.w = i
a.w = l
a.z = e
n.w = l
n.z = e
i.q = l
i.x = b
i.w = d
assert d.q.z.o.v.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

b = A("b")
e = B("e")
l = C("l")
h = D("h")
d = E("d")
a = F("a")
n = F("n")
i = E("i")

b.o = h
b.p = h
e.v = b
e.u = b
e.o = h
l.y = e
l.x = e
l.z = b
h.v = e
h.u = b
d.q = l
d.x = b
d.w = i
a.w = l
a.z = e
n.w = l
n.z = e
i.q = l
i.x = b
i.w = d
assert d.q.z.o.v.u.o.txt == "h"