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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: F = None
        self.y: C = None
        self.u: F = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

b.r = a
a.x = b
a.r = h
a.u = h
a.y = i
a.z = f
m.p = e
m.y = e
m.v = e
m.q = d
m.u = i
m.r = b
g.s = b
d.r = h
d.y = h
h.y = d
h.r = f
h.u = b
h.p = b
f.s = b
n.p = f
n.q = d
n.y = g
n.v = g
n.u = m
n.r = b
e.s = b
i.p = f
i.q = d
i.y = e
i.v = e
i.u = n
i.r = b
assert f.s.r.r.y.r.r.s.r.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: F = None
        self.y: C = None
        self.u: F = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

b.r = a
a.x = b
a.r = h
a.u = h
a.y = i
a.z = f
m.p = e
m.y = e
m.v = e
m.q = d
m.u = i
m.r = b
g.s = b
d.r = h
d.y = h
h.y = d
h.r = f
h.u = b
h.p = b
f.s = b
n.p = f
n.q = d
n.y = g
n.v = g
n.u = m
n.r = b
e.s = b
i.p = f
i.q = d
i.y = e
i.v = e
i.u = n
i.r = b
assert f.s.r.r.y.r.r.s.r.z.s.txt == "b"