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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.v: C = None
        self.z: G = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

f = A("f")
h = B("h")
d = C("d")
i = D("i")
n = E("n")
c = F("c")
l = G("l")
g = F("g")
m = G("m")

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.v: C = None
        self.z: G = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

f = A("f")
h = B("h")
d = C("d")
i = D("i")
n = E("n")
c = F("c")
l = G("l")
g = F("g")
m = G("m")

f.o = h
f.z = h
f.v = c
f.u = d
h.o = f
d.z = n
i.u = n
i.y = n
i.v = d
i.r = d
i.z = m
n.w = f
n.o = d
c.r = i
l.z = n
g.r = i
m.z = n
assert g.r.u.w.o.o.u.z.o.z.txt == "n"