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

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

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

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

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

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

n = A("n")
i = B("i")
c = C("c")
e = D("e")
k = E("k")
d = F("d")
m = E("m")
f = C("f")

n.o = e
i.x = e
c.s = d
c.z = m
e.t = i
e.r = f
k.r = m
k.x = i
d.y = e
m.r = k
m.x = i
f.s = d
f.z = k
assert f.s.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

n = A("n")
i = B("i")
c = C("c")
e = D("e")
k = E("k")
d = F("d")
m = E("m")
f = C("f")

n.o = e
i.x = e
c.s = d
c.z = m
e.t = i
e.r = f
k.r = m
k.x = i
d.y = e
m.r = k
m.x = i
f.s = d
f.z = k
assert f.s.y.r.txt == "f"