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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: A = None
        self.x: C = None
        self.y: C = None
        self.t: B = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: D = None
        self.z: B = None
        self.s: A = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: A = None
        self.x: C = None
        self.y: C = None
        self.t: B = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: D = None
        self.z: B = None
        self.s: A = None
        self.y: D = None
        self.txt = txt

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

d.p = m
b.u = i
b.p = d
i.o = d
i.q = l
n.w = i
n.y = m
l.q = i
l.x = i
l.y = i
l.v = d
l.t = e
l.r = b
g.p = e
g.z = e
g.t = n
g.y = n
g.s = d
e.u = i
e.p = d
c.w = i
c.y = n
m.w = i
m.y = c
h.p = e
h.z = e
h.t = m
h.s = d
h.y = n
assert m.y.y.w.o.p.w.q.v.p.y.txt == "c"