class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.r: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.w: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: G = None
        self.z: A = None
        self.x: D = None
        self.w: A = None
        self.y: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: G = None
        self.t: C = None
        self.x: H = None
        self.s: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: B = None
        self.y: A = None
        self.r: G = None
        self.z: C = None
        self.s: F = None
        self.txt = txt

f = A("f")
e = B("e")
b = C("b")
c = D("c")
l = E("l")
d = F("d")
a = G("a")
m = H("m")

f.z = a
f.r = m
e.o = m
e.w = m
b.p = d
b.y = d
b.q = a
b.z = f
b.w = f
b.x = c
c.r = e
c.p = b
l.x = c
d.r = b
d.t = b
d.u = a
d.x = m
d.s = c
a.u = d
a.y = e
m.p = d
m.s = d
m.q = e
m.y = f
m.r = a
m.z = b
assert f.r.q.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.r: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.w: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: G = None
        self.z: A = None
        self.x: D = None
        self.w: A = None
        self.y: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: G = None
        self.t: C = None
        self.x: H = None
        self.s: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: B = None
        self.y: A = None
        self.r: G = None
        self.z: C = None
        self.s: F = None
        self.txt = txt

f = A("f")
e = B("e")
b = C("b")
c = D("c")
l = E("l")
d = F("d")
a = G("a")
m = H("m")

f.z = a
f.r = m
e.o = m
e.w = m
b.p = d
b.y = d
b.q = a
b.z = f
b.w = f
b.x = c
c.r = e
c.p = b
l.x = c
d.r = b
d.t = b
d.u = a
d.x = m
d.s = c
a.u = d
a.y = e
m.p = d
m.s = d
m.q = e
m.y = f
m.r = a
m.z = b
assert f.r.q.w.y.txt == "f"