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

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

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

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

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

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

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

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

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

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

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

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

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

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

l.p = h
b.o = l
m.o = n
m.w = d
m.s = a
m.u = i
g.w = h
g.v = l
g.q = a
i.o = l
i.p = l
i.v = b
i.y = f
f.q = m
n.o = m
n.w = d
n.s = h
n.u = i
a.w = h
a.q = h
a.v = l
h.w = g
h.v = l
h.q = a
d.o = l
d.p = l
d.v = b
d.y = f
assert i.p.p.v.p.w.q.w.q.v.txt == "l"