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

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

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

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

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

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

j = A("j")
m = B("m")
l = C("l")
k = D("k")
h = E("h")
b = F("b")
g = E("g")
e = A("e")
i = C("i")

j.q = h
j.z = e
m.p = i
l.w = i
l.o = h
l.r = g
k.z = m
k.p = m
k.y = l
k.o = h
h.r = k
h.o = i
b.u = m
b.w = h
g.r = k
g.o = i
e.q = h
e.z = j
i.w = l
i.o = g
i.r = h
assert e.z.z.q.r.o.r.z.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: A = None
        self.txt = txt

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

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

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

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

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

j = A("j")
m = B("m")
l = C("l")
k = D("k")
h = E("h")
b = F("b")
g = E("g")
e = A("e")
i = C("i")

j.q = h
j.z = e
m.p = i
l.w = i
l.o = h
l.r = g
k.z = m
k.p = m
k.y = l
k.o = h
h.r = k
h.o = i
b.u = m
b.w = h
g.r = k
g.o = i
e.q = h
e.z = j
i.w = l
i.o = g
i.r = h
assert e.z.z.q.r.o.r.z.p.o.txt == "g"