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

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

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

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

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

m = A("m")
c = B("c")
e = C("e")
g = D("g")
i = E("i")
a = E("a")
n = C("n")
j = C("j")
b = E("b")

m.p = b
c.q = a
c.u = i
e.s = g
e.p = g
e.v = i
e.q = i
e.u = m
g.p = m
g.y = m
g.w = e
i.o = b
a.o = b
n.s = g
n.p = g
n.v = b
n.u = m
n.q = i
j.s = g
j.p = g
j.v = a
j.u = m
j.q = b
b.o = a
assert j.v.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

m = A("m")
c = B("c")
e = C("e")
g = D("g")
i = E("i")
a = E("a")
n = C("n")
j = C("j")
b = E("b")

m.p = b
c.q = a
c.u = i
e.s = g
e.p = g
e.v = i
e.q = i
e.u = m
g.p = m
g.y = m
g.w = e
i.o = b
a.o = b
n.s = g
n.p = g
n.v = b
n.u = m
n.q = i
j.s = g
j.p = g
j.v = a
j.u = m
j.q = b
b.o = a
assert j.v.o.o.o.o.o.o.o.txt == "b"