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

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: E = None
        self.o: B = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

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

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

d.x = b
d.v = c
j.o = d
m.x = f
m.s = b
m.z = l
l.r = d
l.w = d
l.q = g
l.o = j
l.p = f
i.r = m
g.r = c
b.x = d
b.v = c
f.r = b
f.q = g
f.o = j
f.w = d
f.p = l
c.x = l
c.s = b
c.z = f
e.r = m
assert d.x.x.x.v.z.p.q.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: E = None
        self.o: B = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

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

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

d.x = b
d.v = c
j.o = d
m.x = f
m.s = b
m.z = l
l.r = d
l.w = d
l.q = g
l.o = j
l.p = f
i.r = m
g.r = c
b.x = d
b.v = c
f.r = b
f.q = g
f.o = j
f.w = d
f.p = l
c.x = l
c.s = b
c.z = f
e.r = m
assert d.x.x.x.v.z.p.q.r.s.txt == "b"