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

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

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

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

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

i = A("i")
f = B("f")
l = C("l")
c = D("c")
j = E("j")
a = D("a")
h = B("h")
g = C("g")
n = C("n")
m = B("m")

i.y = n
i.r = n
i.w = c
i.o = h
f.o = h
f.p = j
l.q = g
l.y = c
l.t = j
l.z = j
c.x = l
c.q = a
j.y = a
a.x = l
a.q = c
h.o = m
h.p = j
g.q = n
g.y = c
g.t = j
g.z = j
n.q = l
n.y = c
n.t = j
n.z = j
m.o = f
m.p = j
assert i.o.p.y.q.x.z.y.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.w: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

i = A("i")
f = B("f")
l = C("l")
c = D("c")
j = E("j")
a = D("a")
h = B("h")
g = C("g")
n = C("n")
m = B("m")

i.y = n
i.r = n
i.w = c
i.o = h
f.o = h
f.p = j
l.q = g
l.y = c
l.t = j
l.z = j
c.x = l
c.q = a
j.y = a
a.x = l
a.q = c
h.o = m
h.p = j
g.q = n
g.y = c
g.t = j
g.z = j
n.q = l
n.y = c
n.t = j
n.z = j
m.o = f
m.p = j
assert i.o.p.y.q.x.z.y.q.x.q.txt == "g"