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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: F = None
        self.u: D = None
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

j = A("j")
g = B("g")
l = C("l")
d = D("d")
m = E("m")
n = F("n")
h = B("h")
b = A("b")
e = E("e")
f = C("f")

j.r = d
j.x = e
g.w = e
g.v = e
g.s = f
g.p = d
g.x = j
l.o = n
l.r = d
d.s = j
d.o = j
d.z = g
m.w = j
m.s = n
m.p = n
m.u = d
n.x = m
h.w = e
h.v = e
h.s = l
h.p = d
h.x = j
b.r = d
b.x = m
e.w = j
e.s = n
e.p = n
e.u = d
f.o = n
f.r = d
assert f.r.z.p.z.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: F = None
        self.u: D = None
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

j = A("j")
g = B("g")
l = C("l")
d = D("d")
m = E("m")
n = F("n")
h = B("h")
b = A("b")
e = E("e")
f = C("f")

j.r = d
j.x = e
g.w = e
g.v = e
g.s = f
g.p = d
g.x = j
l.o = n
l.r = d
d.s = j
d.o = j
d.z = g
m.w = j
m.s = n
m.p = n
m.u = d
n.x = m
h.w = e
h.v = e
h.s = l
h.p = d
h.x = j
b.r = d
b.x = m
e.w = j
e.s = n
e.p = n
e.u = d
f.o = n
f.r = d
assert f.r.z.p.z.s.r.txt == "d"