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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: C = None
        self.y: C = None
        self.s: D = None
        self.t: D = None
        self.txt = txt

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

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

a = A("a")
b = B("b")
f = C("f")
c = D("c")
h = E("h")
m = F("m")
g = D("g")

a.s = h
b.x = a
b.o = f
b.t = h
b.s = m
b.v = g
b.p = c
f.z = a
f.x = a
f.p = c
f.r = m
c.u = g
c.s = g
c.t = g
c.w = f
c.y = f
h.r = b
m.y = a
m.w = c
m.u = c
m.s = h
m.q = h
m.v = h
g.u = c
g.s = c
g.t = c
g.w = f
g.y = f
assert b.s.v.r.v.t.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: C = None
        self.y: C = None
        self.s: D = None
        self.t: D = None
        self.txt = txt

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

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

a = A("a")
b = B("b")
f = C("f")
c = D("c")
h = E("h")
m = F("m")
g = D("g")

a.s = h
b.x = a
b.o = f
b.t = h
b.s = m
b.v = g
b.p = c
f.z = a
f.x = a
f.p = c
f.r = m
c.u = g
c.s = g
c.t = g
c.w = f
c.y = f
h.r = b
m.y = a
m.w = c
m.u = c
m.s = h
m.q = h
m.v = h
g.u = c
g.s = c
g.t = c
g.w = f
g.y = f
assert b.s.v.r.v.t.s.w.txt == "f"