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

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

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

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

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

e.v = f
l.q = e
l.u = g
l.o = d
m.s = e
m.q = b
m.w = f
m.u = d
d.q = b
d.x = f
h.v = m
g.q = e
g.u = l
g.o = b
n.q = d
n.x = f
b.q = d
b.x = m
f.s = e
f.q = n
f.w = m
f.u = b
assert f.s.v.u.x.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

e.v = f
l.q = e
l.u = g
l.o = d
m.s = e
m.q = b
m.w = f
m.u = d
d.q = b
d.x = f
h.v = m
g.q = e
g.u = l
g.o = b
n.q = d
n.x = f
b.q = d
b.x = m
f.s = e
f.q = n
f.w = m
f.u = b
assert f.s.v.u.x.q.q.q.txt == "b"