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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: F = None
        self.q: C = None
        self.z: F = None
        self.r: F = None
        self.s: A = None
        self.txt = txt

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

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

d.r = h
n.o = l
n.z = l
n.w = h
n.q = f
n.r = a
n.v = d
g.t = a
g.q = d
g.o = n
a.r = f
f.o = g
f.q = g
f.w = h
f.z = h
f.r = h
f.s = d
h.z = f
h.o = l
h.w = g
l.o = n
l.z = n
l.w = h
l.q = f
l.r = a
l.v = d
assert n.w.z.o.t.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: F = None
        self.q: C = None
        self.z: F = None
        self.r: F = None
        self.s: A = None
        self.txt = txt

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

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

d.r = h
n.o = l
n.z = l
n.w = h
n.q = f
n.r = a
n.v = d
g.t = a
g.q = d
g.o = n
a.r = f
f.o = g
f.q = g
f.w = h
f.z = h
f.r = h
f.s = d
h.z = f
h.o = l
h.w = g
l.o = n
l.z = n
l.w = h
l.q = f
l.r = a
l.v = d
assert n.w.z.o.t.r.w.txt == "h"