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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: E = None
        self.v: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: E = None
        self.v: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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

f.u = g
f.r = g
f.o = i
f.v = l
i.z = a
i.u = a
i.v = g
i.r = c
l.s = g
m.t = g
m.p = a
m.y = c
a.z = l
g.u = f
g.r = f
g.o = d
g.v = l
c.z = a
c.u = a
c.v = f
c.r = d
d.z = a
d.u = a
d.v = g
d.r = c
assert g.v.s.u.r.txt == "g"