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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: A = None
        self.t: D = None
        self.v: B = None
        self.r: D = None
        self.txt = txt

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

i = A("i")
k = B("k")
c = C("c")
l = D("l")
m = E("m")
d = F("d")

i.s = l
k.s = m
k.p = i
c.w = d
c.v = k
l.w = k
l.z = i
l.p = d
l.r = m
m.x = l
m.t = l
m.r = l
m.z = i
m.v = k
d.t = m
d.o = k
d.v = c
assert d.o.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: A = None
        self.t: D = None
        self.v: B = None
        self.r: D = None
        self.txt = txt

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

i = A("i")
k = B("k")
c = C("c")
l = D("l")
m = E("m")
d = F("d")

i.s = l
k.s = m
k.p = i
c.w = d
c.v = k
l.w = k
l.z = i
l.p = d
l.r = m
m.x = l
m.t = l
m.r = l
m.z = i
m.v = k
d.t = m
d.o = k
d.v = c
assert d.o.p.s.txt == "l"