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

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

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

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

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

l = A("l")
b = B("b")
f = C("f")
g = D("g")
e = E("e")
d = B("d")
a = B("a")
m = E("m")
h = A("h")

l.v = h
b.o = m
b.v = a
b.r = g
b.z = f
b.q = f
f.o = d
g.y = f
g.u = f
e.z = m
e.r = f
e.x = f
d.o = m
d.v = b
d.r = g
d.z = f
d.q = f
a.o = e
a.v = b
a.r = g
a.z = f
a.q = f
m.z = e
m.r = f
m.x = f
h.v = l
assert b.z.o.r.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

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

l = A("l")
b = B("b")
f = C("f")
g = D("g")
e = E("e")
d = B("d")
a = B("a")
m = E("m")
h = A("h")

l.v = h
b.o = m
b.v = a
b.r = g
b.z = f
b.q = f
f.o = d
g.y = f
g.u = f
e.z = m
e.r = f
e.x = f
d.o = m
d.v = b
d.r = g
d.z = f
d.q = f
a.o = e
a.v = b
a.r = g
a.z = f
a.q = f
m.z = e
m.r = f
m.x = f
h.v = l
assert b.z.o.r.y.o.txt == "d"