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

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.r: G = None
        self.q: G = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

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

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

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

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

f.w = e
f.r = a
h.z = l
h.u = c
g.y = f
n.w = e
n.y = e
n.p = e
n.r = l
n.q = l
n.o = m
c.o = g
c.r = h
c.q = m
a.s = g
a.v = g
a.z = h
a.p = c
a.u = c
a.x = f
l.o = e
m.w = e
m.y = f
m.p = f
m.r = l
m.q = l
m.o = n
e.w = f
e.r = a
assert c.r.z.o.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.r: G = None
        self.q: G = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

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

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

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

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

f.w = e
f.r = a
h.z = l
h.u = c
g.y = f
n.w = e
n.y = e
n.p = e
n.r = l
n.q = l
n.o = m
c.o = g
c.r = h
c.q = m
a.s = g
a.v = g
a.z = h
a.p = c
a.u = c
a.x = f
l.o = e
m.w = e
m.y = f
m.p = f
m.r = l
m.q = l
m.o = n
e.w = f
e.r = a
assert c.r.z.o.w.w.txt == "e"