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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: C = None
        self.r: B = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: F = None
        self.z: C = None
        self.txt = txt

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

b = A("b")
i = B("i")
d = C("d")
f = D("f")
k = E("k")
m = F("m")
h = C("h")

b.s = k
i.v = k
d.w = m
d.y = h
d.r = i
d.p = k
f.r = b
f.v = m
f.w = m
f.z = k
k.p = d
k.z = d
k.q = m
m.x = i
m.r = i
m.p = b
m.q = h
h.w = m
h.y = d
h.r = i
h.p = k
assert k.q.q.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: C = None
        self.r: B = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: F = None
        self.z: C = None
        self.txt = txt

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

b = A("b")
i = B("i")
d = C("d")
f = D("f")
k = E("k")
m = F("m")
h = C("h")

b.s = k
i.v = k
d.w = m
d.y = h
d.r = i
d.p = k
f.r = b
f.v = m
f.w = m
f.z = k
k.p = d
k.z = d
k.q = m
m.x = i
m.r = i
m.p = b
m.q = h
h.w = m
h.y = d
h.r = i
h.p = k
assert k.q.q.p.q.txt == "m"