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

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

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

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

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

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

c = A("c")
f = B("f")
i = C("i")
m = D("m")
k = E("k")
l = F("l")
h = A("h")
g = C("g")
b = E("b")
e = C("e")

c.r = f
f.s = c
i.s = c
i.r = c
i.y = c
i.w = f
i.u = f
i.x = e
m.x = g
m.t = g
m.w = h
m.r = k
k.s = b
k.z = b
k.v = l
k.w = f
l.y = f
l.v = f
l.p = f
l.z = g
l.u = b
l.x = m
h.r = f
g.s = c
g.r = c
g.w = f
g.u = f
g.y = h
g.x = e
b.s = k
b.z = k
b.v = l
b.w = f
e.s = c
e.r = c
e.y = c
e.w = f
e.u = f
e.x = g
assert h.r.s.r.s.r.s.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

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

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

c = A("c")
f = B("f")
i = C("i")
m = D("m")
k = E("k")
l = F("l")
h = A("h")
g = C("g")
b = E("b")
e = C("e")

c.r = f
f.s = c
i.s = c
i.r = c
i.y = c
i.w = f
i.u = f
i.x = e
m.x = g
m.t = g
m.w = h
m.r = k
k.s = b
k.z = b
k.v = l
k.w = f
l.y = f
l.v = f
l.p = f
l.z = g
l.u = b
l.x = m
h.r = f
g.s = c
g.r = c
g.w = f
g.u = f
g.y = h
g.x = e
b.s = k
b.z = k
b.v = l
b.w = f
e.s = c
e.r = c
e.y = c
e.w = f
e.u = f
e.x = g
assert h.r.s.r.s.r.s.r.s.r.txt == "f"