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

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

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

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

n = A("n")
h = B("h")
m = C("m")
f = D("f")
b = B("b")
i = A("i")
j = D("j")
a = C("a")

n.t = a
n.v = i
n.r = f
h.o = i
h.y = b
m.t = a
m.v = b
m.s = n
f.p = m
f.z = j
f.r = i
f.q = b
b.o = n
b.y = h
i.t = m
i.v = n
i.r = f
j.p = a
j.z = f
j.r = n
j.q = b
a.t = m
a.v = h
a.s = i
assert j.q.y.y.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: A = None
        self.r: D = None
        self.txt = txt

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

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

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

n = A("n")
h = B("h")
m = C("m")
f = D("f")
b = B("b")
i = A("i")
j = D("j")
a = C("a")

n.t = a
n.v = i
n.r = f
h.o = i
h.y = b
m.t = a
m.v = b
m.s = n
f.p = m
f.z = j
f.r = i
f.q = b
b.o = n
b.y = h
i.t = m
i.v = n
i.r = f
j.p = a
j.z = f
j.r = n
j.q = b
a.t = m
a.v = h
a.s = i
assert j.q.y.y.y.o.txt == "i"