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

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: B = None
        self.v: F = None
        self.w: D = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: B = None
        self.v: F = None
        self.w: D = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

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

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