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

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

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

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

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

j = A("j")
m = B("m")
e = C("e")
g = D("g")
c = E("c")
b = C("b")
k = B("k")
d = E("d")

j.o = b
j.v = k
m.p = g
m.r = k
e.o = c
e.q = d
e.v = d
g.u = j
g.q = j
c.u = j
c.w = m
c.x = k
b.o = d
b.q = c
b.v = c
k.p = g
k.r = m
d.u = j
d.w = k
d.x = m
assert e.o.x.p.q.o.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: B = None
        self.txt = txt

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

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

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

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

j = A("j")
m = B("m")
e = C("e")
g = D("g")
c = E("c")
b = C("b")
k = B("k")
d = E("d")

j.o = b
j.v = k
m.p = g
m.r = k
e.o = c
e.q = d
e.v = d
g.u = j
g.q = j
c.u = j
c.w = m
c.x = k
b.o = d
b.q = c
b.v = c
k.p = g
k.r = m
d.u = j
d.w = k
d.x = m
assert e.o.x.p.q.o.v.u.txt == "j"