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

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

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

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

k = A("k")
h = B("h")
m = C("m")
c = D("c")
n = D("n")
e = C("e")
b = A("b")
a = C("a")
d = A("d")
f = B("f")

k.y = c
k.o = f
h.x = d
h.v = c
m.p = n
m.r = c
m.x = b
c.s = d
c.r = h
c.t = n
n.s = b
n.r = h
n.t = c
e.p = n
e.r = n
e.x = d
b.y = c
b.o = h
a.p = n
a.r = c
a.x = d
d.y = c
d.o = f
f.x = d
f.v = n
assert c.s.y.t.t.s.y.r.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: B = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
m = C("m")
c = D("c")
n = D("n")
e = C("e")
b = A("b")
a = C("a")
d = A("d")
f = B("f")

k.y = c
k.o = f
h.x = d
h.v = c
m.p = n
m.r = c
m.x = b
c.s = d
c.r = h
c.t = n
n.s = b
n.r = h
n.t = c
e.p = n
e.r = n
e.x = d
b.y = c
b.o = h
a.p = n
a.r = c
a.x = d
d.y = c
d.o = f
f.x = d
f.v = n
assert c.s.y.t.t.s.y.r.v.t.txt == "n"