class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: E = None
        self.v: C = None
        self.p: E = None
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: B = None
        self.z: B = None
        self.t: B = None
        self.q: C = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
c = D("c")
i = E("i")
a = E("a")
b = C("b")
h = C("h")

g.x = c
g.u = c
g.w = a
g.p = a
g.v = b
d.y = h
d.x = c
d.o = i
f.q = i
c.w = f
c.o = b
i.x = c
i.p = d
i.z = d
i.t = d
i.q = h
a.x = c
a.p = d
a.z = d
a.t = d
a.q = b
b.q = i
h.q = a
assert d.x.o.q.p.o.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: E = None
        self.v: C = None
        self.p: E = None
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: B = None
        self.z: B = None
        self.t: B = None
        self.q: C = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
c = D("c")
i = E("i")
a = E("a")
b = C("b")
h = C("h")

g.x = c
g.u = c
g.w = a
g.p = a
g.v = b
d.y = h
d.x = c
d.o = i
f.q = i
c.w = f
c.o = b
i.x = c
i.p = d
i.z = d
i.t = d
i.q = h
a.x = c
a.p = d
a.z = d
a.t = d
a.q = b
b.q = i
h.q = a
assert d.x.o.q.p.o.q.q.q.txt == "b"