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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: A = None
        self.t: C = None
        self.u: F = None
        self.x: C = None
        self.r: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: A = None
        self.t: C = None
        self.u: F = None
        self.x: C = None
        self.r: F = None
        self.txt = txt

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

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

i.r = d
j.o = m
j.z = d
m.x = k
m.s = i
m.z = d
d.p = j
d.x = j
d.w = j
d.t = h
d.o = h
d.r = k
h.o = b
h.u = b
h.r = b
h.v = i
h.t = m
h.x = m
b.y = h
b.v = k
k.r = d
assert m.s.r.r.r.w.o.x.txt == "k"