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

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

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

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

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

l = A("l")
m = B("m")
a = C("a")
i = D("i")
g = E("g")
c = B("c")
h = B("h")
f = D("f")

l.s = a
l.v = a
m.r = g
m.o = c
a.t = c
a.w = m
a.q = g
i.p = l
i.w = g
g.u = a
g.p = l
g.q = l
c.r = g
c.o = m
h.r = g
h.o = c
f.p = l
f.w = g
assert f.w.u.t.o.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

l = A("l")
m = B("m")
a = C("a")
i = D("i")
g = E("g")
c = B("c")
h = B("h")
f = D("f")

l.s = a
l.v = a
m.r = g
m.o = c
a.t = c
a.w = m
a.q = g
i.p = l
i.w = g
g.u = a
g.p = l
g.q = l
c.r = g
c.o = m
h.r = g
h.o = c
f.p = l
f.w = g
assert f.w.u.t.o.r.u.txt == "a"