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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: C = None
        self.r: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: C = None
        self.r: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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