class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: D = None
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: F = None
        self.txt = txt

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

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

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

i.s = b
i.y = n
i.z = h
i.v = l
f.x = n
f.s = i
m.p = b
m.r = h
m.x = k
n.p = f
n.y = k
g.q = l
g.s = l
k.r = b
b.q = m
b.s = m
h.p = g
h.r = l
h.x = k
e.x = n
e.s = i
l.p = g
l.r = m
l.x = k
assert h.x.r.q.p.s.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: D = None
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: F = None
        self.txt = txt

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

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

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

i.s = b
i.y = n
i.z = h
i.v = l
f.x = n
f.s = i
m.p = b
m.r = h
m.x = k
n.p = f
n.y = k
g.q = l
g.s = l
k.r = b
b.q = m
b.s = m
h.p = g
h.r = l
h.x = k
e.x = n
e.s = i
l.p = g
l.r = m
l.x = k
assert h.x.r.q.p.s.r.x.txt == "k"