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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.v: B = None
        self.z: C = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
k = C("k")
h = D("h")
l = E("l")
m = A("m")
g = E("g")
d = B("d")

f.v = d
f.u = k
f.y = h
n.o = f
n.w = g
n.v = d
n.z = k
k.p = l
k.r = m
h.u = g
l.t = n
m.v = n
m.u = k
m.y = h
g.t = n
d.o = m
d.w = g
d.v = n
d.z = k
assert k.r.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: C = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.v: B = None
        self.z: C = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
k = C("k")
h = D("h")
l = E("l")
m = A("m")
g = E("g")
d = B("d")

f.v = d
f.u = k
f.y = h
n.o = f
n.w = g
n.v = d
n.z = k
k.p = l
k.r = m
h.u = g
l.t = n
m.v = n
m.u = k
m.y = h
g.t = n
d.o = m
d.w = g
d.v = n
d.z = k
assert k.r.y.u.txt == "g"